Using Master Page as the DB reader which implements the reading on all child pages [modified]
-
hello, i want to add a "hello ___" to all my pages. now , in order not to duplicate code , i can put it in the master page. in the master page i go and look for the user entered from the query string at the DB and put the name after the hello or Guest if i get null. this works fine. now, in the child pages i also want to use this DB output , so i use session to store the DB entry for later use by the child. my problem is that the child page's On_Load is performed prior to the Master page's On_Load and this causes the DB entry to be null before it was read by the Master page. does anyone have any idea how to solve this problem ? can i use the Page_Init in the master page for this ? is it acceptable and stable ? tnx, avi
modified on Wednesday, April 22, 2009 3:54 PM
-
hello, i want to add a "hello ___" to all my pages. now , in order not to duplicate code , i can put it in the master page. in the master page i go and look for the user entered from the query string at the DB and put the name after the hello or Guest if i get null. this works fine. now, in the child pages i also want to use this DB output , so i use session to store the DB entry for later use by the child. my problem is that the child page's On_Load is performed prior to the Master page's On_Load and this causes the DB entry to be null before it was read by the Master page. does anyone have any idea how to solve this problem ? can i use the Page_Init in the master page for this ? is it acceptable and stable ? tnx, avi
modified on Wednesday, April 22, 2009 3:54 PM
Use the Mater Page's Page_Init event to run the code. That event fires before the child pages load event.
I didn't get any requirements for the signature
-
Use the Mater Page's Page_Init event to run the code. That event fires before the child pages load event.
I didn't get any requirements for the signature