3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by serkan sendur
0

In your code view just type override then space then find OnInit or OnLoadComplete then click Tab to complete the code.

Here is the example:

protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
    }
    protected override void OnLoadComplete(EventArgs e)
    {
        base.OnLoadComplete(e);
    }
0

you dont have to override anything, notice that your .aspx page have :

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

AutoEventWireup is set to true by default, which means you dont need to wire your events, just write your event handler functions and they will be registered automatically. The code below writes three lines of text to a file using Page_Unload event handler.

using System;
using System.IO;
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Page_Unload(object sender, EventArgs e)
    {
        // Compose a string that consists of three lines.
        string lines = "First line.\r\nSecond line.\r\nThird line.";

        // Write the string to a file.
        System.IO.StreamWriter file = new System.IO.StreamWriter("c:\\test.txt");
        file.WriteLine(lines);

        file.Close();
    }
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.