Click here to Skip to main content
15,997,776 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have three user control in my master page. upon some condtion i am setting the visibility of two user control to false and one to true. even if i set the visibility property to false particular user control's events get fire. i want to prevent the loading of user control which has visibile property to flase can anyone help me out.

sorry for my spelling and grammetical mistake
Posted

1 solution

if you need to execute code only if its visible then I think you should move the code to Control's PreRender event.
All controls will raise their Init and Load events regardless of whether they're visible or not hence its only executed if its visible
 
Share this answer
 
v2
Comments
Ankur\m/ 29-Jan-11 1:23am    
ASP.NET do not render a control whose visibility is set to false.
So no point that it will have Init or Load or for that matter any events.
RaviRanjanKr 29-Jan-11 2:02am    
yeah you are right Ankur

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