Here’s the simplest example of the problem:
I should describe the commands I’m using. In the initial pass through the VB Page_Load event I have :
txtAge.Enabled = "False"
txtAge.Text = “xx”
document.getElementById('txtAge').value = intAge.toString();
I too am dealing with this issue
In your case the issue may be worked around by using the readOnly property but once you venture outside of textbox controls you will run into the problem I'm dealing with. The readOnly property doesn't apply to all HTML elements so it cannot be used as a pseudo disable. I have a situation in which I have a listbox control I need to disable when the user submits the form. The problem is the listbox contains a list of items the user has selected to be processed by the form so when my .Net code begins to execute after the form is posted back, it finds no items in the listbox have been selected.
I've considered reworking the form using AJAX since it really should have been designed that way in the first place anyway but this is one of those annoying issues that I would like to find a solution to prior to moving on. I suspect that if I just work around it now I'll only find myself faced with the same issue in the future.
One thing you can do is check the Page.IsPostback in the Page_Load sub. If the page is being posted (ie. not the original load) then don't set the text field to disabled and = "xx".
Or in my case, I'm moving to .NET 2.0 which will give me the capability of posting back controls/elements that are disabled. Of course not everyone can simply rework their application and move from 1.1 to 2.0 .
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center