Click to See Complete Forum and Search --> : Load Events not being executed on Master Page
harvey.dan1
December 6th, 2008, 03:10 PM
I am working on a master page and I want to display data dynamically on the page. When I add the code to the Page_load it never gets executed. I tried setting AutoEventWireup="true" but it still doesn't work. Please advise! Thanks!
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'killer code
End Sub
toraj58
December 8th, 2008, 02:34 AM
enable Trace in your page.
for doing it you should add the Trace attribute to the Page directive:
<%@ Page Language="VB" Trace="True" ...
Save the file and run the application. you will see several pages worth of information to the end of the page.
The Trace Information shows four columns:
1- Category: The category of the message. All messages generated by ASP.NET for the page have the page name as the category.
2- Message: An individual trace message. By default, some of the ASP.NET events are shown, with two messages for each, one for the start of the event and one for the end.
3- From First(s): The time in seconds since the first message was displayed.
4- From Last(s): The time in seconds since the last message was displayed.
that was the first step to ensure that all events works if you passed it then IMHO you can try next step:
taking into consideration that the problem maybe in the code you want to update not Page_Load hence i suggest you that you test it with a some simple steps:
1- add a Lable Control to your master page
2- in the Page_Load change the text of the lable e.g.: lable1.Text = "test";
3- turn off the trace mode in the page directive:
<%@ Page Language="VB" Trace="False" ...
4- save the changes and run the app
if everything was okay and lable updated then the problem is in your code not Page_Load.
dannystommen
December 8th, 2008, 03:12 AM
I don't know if there is any difference between VB and C#, but I have an masterpage without 'Trace=true' and the page_load event of the master page is executed evertytime a page is loaded.
toraj58
December 10th, 2008, 08:16 AM
there is no difference between C# and VB in this case.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.