Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Page_Load Not Executing 1

Status
Not open for further replies.

Fubear

IS-IT--Management
Sep 11, 2002
299
GB
ok, I dont know what i have done to cause this - but somehow I managed to 'unlink' my events from my objects.

say I have a button which executes Button_Click event, the code is still there, but I had to go bac to the button in VS.NET and select that method for the event from the designer again.

The only thing I cant relink is hte Page_Load event. It is simply not executing. I have commented out everything in the page load event except one line which is not doing anything.

---
From my Main.aspx:
<%@ Page language=&quot;c#&quot; Codebehind=&quot;main.aspx.cs&quot; AutoEventWireup=&quot;false&quot; Inherits=&quot;FH.test2&quot; %>

From Main.aspx.cs:
Private void Page_Load(object sender, System.EventArgs e)
{
lblTest.Text=&quot;F00&quot;;
/* Commented Code */
}
---
test2 was the original name of the class, and i renamed the file to Main a long time ago before anyone asks about that. It has always worked up until now.

I cant really test anything without the page_load as it calls all my databinding methods and selects which panels to display.
 
You'll need to change this line in your Page declaration in Main.aspx:

AutoEventWireup=&quot;false&quot;

...to:

AutoEventWireup=&quot;true&quot;

Doing so allows the Common Language Runtime to automatically handle the page-level events for you. You would normally turn this off (set it to false) when using methods that occurred after posting back, without having to load anything in Page_Load.
 
Didnt work :-(
I changed the one line and my test code is still not executing.
 
Oops, was looking int the wrong window.
Worked Fine

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top