C
chefo
Well, the subject describes my problem quite well Here is some
additional information.
I use a common base class for all the pages in my project. It is
derived from Page and it is not abstract, because there was some
problem with the compilation. I define a common Page_Unload handler in
the base class and subscribe for the event like this:
public class IPage : System.Web.UI.Page
{
override protected void OnInit(EventArgs e)
{
/* ... */
base.OnInit(e);
this.PreRender += new EventHandler(IPage_PreRender);
this.Load += new EventHandler(IPage_Load);
this.Unload += new EventHandler(IPage_Unload);
}
protected virtual void IPage_Unload(object sender, EventArgs e)
{
if ( IsPostBack )
{
/* ... */
}
}
}
In the derived class unload is not mentioned at all. The first time the
page is loaded IPage_Unload gets executed once. When I click a submit
button the page is posted back to the server, the Page_Load event is
fired, then the button click handler, Page_Unload follows and finally,
gues what... Page_Unload again. Any idea why is this happening? This
is not happening for every page in the project, only for a particular
one and maybe some others. There is little delay between the two
successive Page_Unload executions, less than between Page_Load and
Page_Unload. Any suggestions?
Thanks all
additional information.
I use a common base class for all the pages in my project. It is
derived from Page and it is not abstract, because there was some
problem with the compilation. I define a common Page_Unload handler in
the base class and subscribe for the event like this:
public class IPage : System.Web.UI.Page
{
override protected void OnInit(EventArgs e)
{
/* ... */
base.OnInit(e);
this.PreRender += new EventHandler(IPage_PreRender);
this.Load += new EventHandler(IPage_Load);
this.Unload += new EventHandler(IPage_Unload);
}
protected virtual void IPage_Unload(object sender, EventArgs e)
{
if ( IsPostBack )
{
/* ... */
}
}
}
In the derived class unload is not mentioned at all. The first time the
page is loaded IPage_Unload gets executed once. When I click a submit
button the page is posted back to the server, the Page_Load event is
fired, then the button click handler, Page_Unload follows and finally,
gues what... Page_Unload again. Any idea why is this happening? This
is not happening for every page in the project, only for a particular
one and maybe some others. There is little delay between the two
successive Page_Unload executions, less than between Page_Load and
Page_Unload. Any suggestions?
Thanks all