Reputation: 4762
I have a button that is linked to a checkbox via a javascript code, meaning that when the checkbox is checked, the button is enabled and vise versa. The initial value of the button (in ASP markup) is disabled, as well as the chekbox
Now when postback, whichever the button is enabled or not (after playing in javascript), the button is read as (enabled false) in server side (which is the initial value) can I read the last client-side .disabled value of the button from within ASP.NET (server side)? If so I can assign the client-side value (the real value of the button) to the server side 'enable' property.
Upvotes: 0
Views: 870
Reputation: 584
All asp.net controls are initialized using their earlier states when a postback happens. THat means the enabled="false" value will be used to reinitialize the button control when your page postback happens. So the enabling done by your javascript code will not have any effect there.
You will have to make some tweaks to your code so that this can be achieved.
page_load ()
if(ispostback){ //read the value of the hidden control and set the enabled/disabled property of the button accordingly. }
Upvotes: 1