UpdatePanel Problem?
Feb 14, 2007I have a page where the user enters the information, and clicks on submit then the information is saved into the database. Second time, when the same user navigates to that page, the page picks up the data from database and be populated accordingly.
I have implemented ASP.Net Ajax: UpdatePanel into this page. First time (at the time of creation), it works perfectly. But when it comes second time (in edit mode), as the page is popupated as values from the database, it does not work properly.
For example:
- There is a RadioButtonList and TextBox with Submit Button on the page.
- TextBox is disabled by default.
- RadioButtonList has two options (Yes) and (No)
- Selecting (Yes) from RadioButtonList, TextBox is enabled and on selecting (No), TextBox is disabled.
- But RadioButtonList needs a postback and page flickers. So, I decided to implement Ajax:UpdatePanel into the page.
- After implementing UpdatePanel with UpdateMode=Conditional, when you select (Yes) or (No) on RadioButtonList, it only renders TextBox and page does not flicker, it means it works perfectly.
- But second time (in edit mode, when record already exists in database), in Page_Load, it fetches the record from the database and as per values populates the page. Like if RadioButtonList was Yes then it is selected as Yes and TextBox is populated with value. Now you try to select (No) from RadioButtonList, it will disable the TextBox and select again (Yes) option, -- it will not enable the TextBox to enter the value.--