|
-
May 25th, 2009, 06:35 AM
#2
Re: Prevent data loss in Postback
That's normal behavior. When any post back occurs, it'll first do the usual Page_Init, Page_Load and then get to your event. The idea here is that if you need to perform any initializations or resource settings, you do it in those events. Read more about the ASP.NET Page Life Cycle
If you want to avoid certain things from happening on each postback, use Page.IsPostBack which is a boolean. If you have dynamically generated controls, regenerate them in Init or Page Load so that viewstate can be assigned to them and you don't lose the values.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|