Hi All, I am developing a web part that uses AJAX Timer and Update Panel to perform some data check. There are two buttons outside the Update Panel on the web part that I also want to maintain during the Timer postback. I cannot put these two buttons in any UpdatePanel because they need to call Response.Write( ) to display some Excel data to users in their On_Click event. My current solution is using ViewState to maintain these two button in On_Load event. However, I am not sure if this is a correct solution (haven't tested it). Does any one know that during a Timer postback, if I disable/enable these two buttons using ViewState in On_Load, will it update the page properly with the two buttons disabled/enabled? Or will it ignore any control that are not in the UpdatePanel regardless where you maintain it? If my solution is not a good practice, can someone suggest other alternatives? Thank you.
How to Maintain Button State in On_Load on AJAX Timer Postbacks?
Collapse
X
-
mlingTags: None -
If the Timer control is within the UpdatePanel, and the buttons are outside of the UpdatePanel, then then you cannot disable the buttons within the Timer's Tick Event....
Well you can, but they will not appear as disabled when the response returns to the browser after the timer tick event has fired.
You should not be using Response.Write in your VB.NET or C# code. When you do, it is unlikely that the string supplied to the Response.Write method will be written in a valid place in the HTML page that is generated. (Usually the string is placed above the <html> tag or some other random place...which makes your html invalid)
I recommend using a Label, Localizable or even a Literal control to display the data instead. When you retrieve the data from Excel, set the Label.Text value to what you would have supplied to the Response.Write( ) method.
I'm not entirely sure why your buttons cannot be within the UpdatePanel?
Comment