Reputation: 1715
i am using user control in asp.net , it is loading for first time in page load event & later on every post back event it doesn't load at all.
Note. I am adding user control in page_load event in if(!ispostback) condition.
Is there a way to avoid reloading user control every time??
Thanks.
Upvotes: 0
Views: 253
Reputation: 2477
Sorry: You must create dynamically created controls EACH and every time the Page loads, if you "avoid" it there just is no control. PostBack or not, everything you want to use must be created.
Also, please create controls in Page_Init, it belongs there, especially if you're relying on PostBack and ViewState.
Further reading: ASP.NET Page Life Cycle Overview
Upvotes: 1