473,326 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

How to Maintain Button State in On_Load on AJAX Timer Postbacks?

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.
Nov 14 '10 #1
1 1621
Frinavale
9,735 Expert Mod 8TB
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?
Nov 16 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: George | last post by:
Hi, I have a usercontrol which handles the menu functions which is included in the main form.My requirement is to pass a variable to the server and maintain its state when I click an item in the...
4
by: riscy | last post by:
I have a button with mouse_click event when pushed. However it does not generates mouse down event. To fix this I could poll the mouse state every 10mSec and see if the mouse button remains down...
2
by: Varangian | last post by:
Hi there again... is there a way to maintain the ViewState of WebControls when using AJAX or Callbacks ? Every time I refresh a page or use a postback from a control it would loose the...
1
by: keithb | last post by:
Can someone provide general information on how to maintain state for a treeview control. Specifically, I need the application to maintain node expansion across postbacks. Thanks, Keith
0
by: gregfocker | last post by:
I installed the new RTM version of ASP.NET 2.0 AJAX Extensions 1.0 released on Tuesday (1/23). I made the required changes to the web.config file to go from the RC version to the RTM version. ...
11
by: Joseph Geretz | last post by:
I've been looking at two approaches for the maintenance of Session state for a Web Service application. One approach uses the old familiar Session object which I've used in the past for Web...
0
by: kloppie | last post by:
Hi, im trying to update a Label after a ajax:Timer Tick has occured. Each timer tick makes an async reguest to the server and a UpdatePanel is updated. The problem is that i want to display the...
8
by: rahulnag22 | last post by:
I have created a button widget with a button click binding. The button initially has a state=disabled. I can see the greyed out version of the button in the GUI. But If I click on the button it...
0
by: news.rz.uni-karlsruhe.de | last post by:
I want to deactivate the Ajax timer from clientside with javascript - that is, it should not raise any postbacks any more. Which method/propertie is there I can use to chieve this and most...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.