473,583 Members | 3,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

persisting viewstate for disabled webcontrols

I'm having trouble persisting viewstate information for webcontrols I've
disabled via javascript. I have a group of textboxes that I enable/disable
via a checkbox control that invokes a javascript method in its onclick
attribute. When the page does a postsback, the textboxes that are enabled
have their viewstate persisted; however, the ones that are disabled (but
still have text in them) do not have their viewstate persisted. I have
perused Scott Mitchell's articles about viewstate in asp .net pages, and
according to him, controls that are disabled should have a persistant
viewstate (as long as they're not in a disabled div tag). Long story short,
I've tried many things to get this to work including trying to use the
readonly property instead of enabled/disabled, but I can't get it to work
with javascript. I'm trying to minimize the number of postbacks this webapp
will make, so using javascript is essential.
Jul 22 '05 #1
1 1654
Update: I've tried control.setAttr ibute("readonly ","readonly ");
For some reason this doesn't work. Anybody have any ideas?

"David Anderson" wrote:
I'm having trouble persisting viewstate information for webcontrols I've
disabled via javascript. I have a group of textboxes that I enable/disable
via a checkbox control that invokes a javascript method in its onclick
attribute. When the page does a postsback, the textboxes that are enabled
have their viewstate persisted; however, the ones that are disabled (but
still have text in them) do not have their viewstate persisted. I have
perused Scott Mitchell's articles about viewstate in asp .net pages, and
according to him, controls that are disabled should have a persistant
viewstate (as long as they're not in a disabled div tag). Long story short,
I've tried many things to get this to work including trying to use the
readonly property instead of enabled/disabled, but I can't get it to work
with javascript. I'm trying to minimize the number of postbacks this webapp
will make, so using javascript is essential.

Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1371
by: Tomas Vera | last post by:
Here's another goofy thing. I need to persist the state of items added dynamically to a Panel control between round-trips to the server. I have a web form that contains a TreeView and a DropDownList My web form reads the value of the drop down list, runs a query against a database, then presents the results of the query to the user with...
3
2636
by: Steve Drake | last post by:
All, I have a CONTROL that contains 1 control (Control ONE), the 1 control that it can contain 1 or 2 control (Control A and B). Control A, raises and event and Control ONE receives this event and this causes control B to be created, when this is done the VIEWSTATE is lost for CONTROL B. In the EVENT that causes CONTROL B to be created...
2
3184
by: Jay Walker | last post by:
I created a custom DataGridColumn based on Marcie Robillard's MSDN Article: Creating Custom Columns for the ASP.NET Datagrid http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/creatingcustomcolumns.asp The problem I am having is that the data in the custom datagridcolumn is not saved to viewstate and after...
1
1651
by: lim | last post by:
What is the possible error that occurs when the Page_load event is not triggered during execution. In my page there's some basic server control. Is there any loops holes?
5
9156
by: Leo J. Hart IV | last post by:
Hello, I'm hoping someone can help me out. I was wondering if the Enabled property of a CheckBox or RadioButton server control is stored in the ViewState. If not, is there some way to to add this property to ViewState? If needed, I can give you more info on exactly what I'm trying to do. Thanks,
1
5420
by: olduncleamos | last post by:
Hello all, I am experimenting with the repeater control and ran into something that I wasn't expecting. I would appreciate if the experts can confirm or correct my understanding. Here is a fragment of a very simple page that I wrote that will drill down into the displayed item. The result is to be display on the same page so that the...
4
2211
by: Sven Jacobs | last post by:
Hello everybody! Imagine a form with several TextBox WebControls and two buttons "New" which should clear the form and "Save". On reloading or leaving the page which holds the form the TextBoxes should be cleared so I've disabled the ViewStates of these TextBoxes by setting the EnableViewState property to false. The method which is bound...
9
4905
by: Jamie | last post by:
I am receiving an Invalid ViewState error after posting back to the same page twice. Consistently the error occurs after the second postback and not after the first. I have looked into creating a static machinekey in the machine.config and that did not help. I believe that issue only occurred when there was an inconsistent viewstate...
1
266
by: David Anderson | last post by:
I'm having trouble persisting viewstate information for webcontrols I've disabled via javascript. I have a group of textboxes that I enable/disable via a checkbox control that invokes a javascript method in its onclick attribute. When the page does a postsback, the textboxes that are enabled have their viewstate persisted; however, the ones...
0
7894
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8176
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
6578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5699
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5370
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3816
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3841
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1426
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.