Help me out: ASP.Net BUG: Page_Load event not called!

G

Guest

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 : (e-mail address removed)

Thanks in advance
NGM
 
S

Sam Fields

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 said:
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!!!!
 
M

Marina

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 said:
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!!!!
 
G

Guest

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 said:
Hello All asp.net
Please help me out on this
and i have put in a seperate DLL
using System.Web
namespace FCTest

public class Handler : System.Web.UI.Pag

protected override void OnLoad(EventArgs args
System.Web.UI.Page (it does not make a difference as Handler class inherit
from System.Web.UI.Page
using System.Web.UI.WebControls
using System.Web.UI.HtmlControls
using FCTest1

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
 
Joined
Jul 12, 2012
Messages
1
Reaction score
0
Check this value in Page top AutoEventWireup="true" if it is false page_load wil not call

Sudipta Banerjee
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top