![]() |
Help me out: ASP.Net BUG: Page_Load event not called!
Hello All,
From one week rather developing any code i have been discovering BUGS in asp.net, Please help me out on this! I have class say 'Handler' which inherits System.Web.UI.Page, and i have put in a seperate DLL, The code is show below: using System; using System.Web; namespace FCTest1 { public class Handler : System.Web.UI.Page { protected override void OnLoad(EventArgs args) { } } } Now i inherit by wepage class from 'Handler' class instead of System.Web.UI.Page (it does not make a difference as Handler class inherits from System.Web.UI.Page) Here is the simple code: using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using FCTest1; namespace FCWebTest1 { public class WebForm1 : FCTest1.Handler { private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here int i = 1; //<----- Control never reaches here!!! Help me out please! Response.Write("Hello"); } } } Now the problem is the Page gets loaded and the Page_Load never gets called!!!, the control simply does not reach there at all!!!! Is this a BUG?? is there any workaround for this??? Please help me out asap! I really in need of solutions, you can mail me at : ngm_bec@yahoo.com Thanks in advance NGM |
Re: Help me out: ASP.Net BUG: Page_Load event not called!
You didn't accidently remove the:
this.Load += new System.EventHandler(this.Page_Load); from the InitializeComponent() method in the web form designer generated code, did you? Hope this helps. Sam "NGM" <ngm_bec@yahoo.com> wrote in message news:1F59FCB7-B506-49B8-B5A7-0DA132BBF14F@microsoft.com... > Hello All, > > From one week rather developing any code i have been discovering BUGS in asp.net, > Please help me out on this! > > I have class say 'Handler' which inherits System.Web.UI.Page, > and i have put in a seperate DLL, > > The code is show below: > > using System; > using System.Web; > namespace FCTest1 > { > public class Handler : System.Web.UI.Page > { > protected override void OnLoad(EventArgs args) > { > } > } > } > > Now i inherit by wepage class from 'Handler' class instead of System.Web.UI.Page (it does not make a difference as Handler class inherits from System.Web.UI.Page) > > Here is the simple code: > > using System.Web.UI; > using System.Web.UI.WebControls; > using System.Web.UI.HtmlControls; > using FCTest1; > > namespace FCWebTest1 > { > public class WebForm1 : FCTest1.Handler > { > private void Page_Load(object sender, System.EventArgs e) > { > // Put user code to initialize the page here > int i = 1; //<----- Control never reaches here!!! Help me out please! > Response.Write("Hello"); > } > } > } > > Now the problem is the Page gets loaded and the Page_Load never gets called!!!, the control simply does not reach there at all!!!! > > Is this a BUG?? is there any workaround for this??? > > Please help me out asap! > > I really in need of solutions, you can mail me at : ngm_bec@yahoo.com > > Thanks in advance > NGM > |
Re: Help me out: ASP.Net BUG: Page_Load event not called!
Your OnLoad in the base class doesn't do anything. If it doesn't call
base.OnLoad, then the Load event won't happen. And if the Load event doesn't happen, you can't expect any handlers for it to fire. You should be careful about overriding methods if you don't really understand how they work. "NGM" <ngm_bec@yahoo.com> wrote in message news:1F59FCB7-B506-49B8-B5A7-0DA132BBF14F@microsoft.com... > Hello All, > > From one week rather developing any code i have been discovering BUGS in asp.net, > Please help me out on this! > > I have class say 'Handler' which inherits System.Web.UI.Page, > and i have put in a seperate DLL, > > The code is show below: > > using System; > using System.Web; > namespace FCTest1 > { > public class Handler : System.Web.UI.Page > { > protected override void OnLoad(EventArgs args) > { > } > } > } > > Now i inherit by wepage class from 'Handler' class instead of System.Web.UI.Page (it does not make a difference as Handler class inherits from System.Web.UI.Page) > > Here is the simple code: > > using System.Web.UI; > using System.Web.UI.WebControls; > using System.Web.UI.HtmlControls; > using FCTest1; > > namespace FCWebTest1 > { > public class WebForm1 : FCTest1.Handler > { > private void Page_Load(object sender, System.EventArgs e) > { > // Put user code to initialize the page here > int i = 1; //<----- Control never reaches here!!! Help me out please! > Response.Write("Hello"); > } > } > } > > Now the problem is the Page gets loaded and the Page_Load never gets called!!!, the control simply does not reach there at all!!!! > > Is this a BUG?? is there any workaround for this??? > > Please help me out asap! > > I really in need of solutions, you can mail me at : ngm_bec@yahoo.com > > Thanks in advance > NGM > |
Re: Help me out: ASP.Net BUG: Page_Load event not called!
No Sam.
I never did that....Please try out the code... Thanks a lo ----- Sam Fields wrote: ---- You didn't accidently remove the this.Load += new System.EventHandler(this.Page_Load) from the InitializeComponent() method in the web form designer generate code, did you Hope this helps Sa "NGM" <ngm_bec@yahoo.com> wrote in messag news:1F59FCB7-B506-49B8-B5A7-0DA132BBF14F@microsoft.com.. > Hello All >> From one week rather developing any code i have been discovering BUGS i asp.net > Please help me out on this >> I have class say 'Handler' which inherits System.Web.UI.Page > and i have put in a seperate DLL >> The code is show below >> using System > using System.Web > namespace FCTest > > public class Handler : System.Web.UI.Pag > > protected override void OnLoad(EventArgs args > > > > >> Now i inherit by wepage class from 'Handler' class instead o System.Web.UI.Page (it does not make a difference as Handler class inherit from System.Web.UI.Page >> Here is the simple code >> using System.Web.UI > using System.Web.UI.WebControls > using System.Web.UI.HtmlControls > using FCTest1 >> namespace FCWebTest > > public class WebForm1 : FCTest1.Handle > > private void Page_Load(object sender, System.EventArgs e > > // Put user code to initialize the page her > int i = 1 //<----- Control never reaches here!!! Help me out please > Response.Write("Hello") > > > >> Now the problem is the Page gets loaded and the Page_Load never get called!!!, the control simply does not reach there at all!!! >> Is this a BUG?? is there any workaround for this?? >> Please help me out asap >> I really in need of solutions, you can mail me at : ngm_bec@yahoo.co >> Thanks in advanc > NG > |
Check this value in Page top AutoEventWireup="true" if it is false page_load wil not call
Sudipta Banerjee |
| All times are GMT. The time now is 04:07 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.