Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi to all,

In my asp.net web application the master page is being loaded each and every-time when child page is loading or some event of child page is fired. The problem is that when any event is performed, the master page load event calls and every method of master page is loading again and again. So unnecessary round trips happens and any event is taking a long time to perform. Thats why my application gets slow.
please help me...

thanks in advance....
Posted
Comments
Sanjay Kunjam 6-Jul-12 7:02am    
Hi,

If you use Master page then its compulsorily load all event of Master page, if you don't want to fire them, i think you should avoid including master page.

Its better to create User Control for your header or footer banner.

1 solution

All the method of master page pace inside
C#
if(!IsPostback)
{
//All the method which you don't want to execute.
}

For the 1st time the methods of master page will execute than it will not go inside than.
 
Share this answer
 
Comments
souvikcode 13-Nov-14 4:47am    
have you tested that?Each page load means master load.Post back is for page load due to postback by control.But if you load a child page it is not postback of master,it is fresh load.
bhagirathimfs 14-Nov-14 8:01am    
You are right. On Child page load it will execute all the method inside the master load event even if the postback check is present. But on click of any child button or any post back from child or master it will not execute it. So that the page load may take some minute but after that page will act fast.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900