Jag har suttit och funderat ett tag över hur man tar kontroll över Page_Load, när man kör med codebehind och kommit fram till metoder
using System;
using System.Web.UI;
[blue]// metod 1[/blue]
public class cPage : Page
{
override protected void OnInit(EventArgs e)
{
this.Load += new System.EventHandler(this.Page_Load);
}
protected void Page_Load(object objSrc, EventArgs e)
{
if(this.IsPostBack)
Response.Write("Tjohopp...");
}
}
[blue]// metod 2[/blue]
public class cPage : Page
{
override protected void OnLoad(EventArgs e)
{
if(this.IsPostBack)
Response.Write("Tjohopp...");
}
}
Har det någon betydelse vilken metod jag använder?