|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
asp:label updated via javascript does not get its value saved in the viewstateHi all,
I have a label on a webpage that shows the result of a calculation. When the page is loaded, the label text is "", and is updated with javascript via its innerText property. Once I click on a asp:button, I try to check the value of the label and it is still "" in the button click event, even tho it had a numeric value when the data was sent. Is it normal that asp.net does not get the value of a label if it is changed via javascript? If so, how can I achieve what I want? thanks a lot ibiza Yes, this is how it is designed.
You can replace the label with a textbox and style it in the way that it will look like a label. Or you can pass the value to the server in a separate hidden input. Eliyahu Show quoteHide quote "ibiza" <lambe***@gmail.com> wrote in message news:1141141977.003927.317090@e56g2000cwe.googlegroups.com... > Hi all, > > I have a label on a webpage that shows the result of a calculation. > When the page is loaded, the label text is "", and is updated with > javascript via its innerText property. Once I click on a asp:button, I > try to check the value of the label and it is still "" in the button > click event, even tho it had a numeric value when the data was sent. > > Is it normal that asp.net does not get the value of a label if it is > changed via javascript? If so, how can I achieve what I want? > > thanks a lot > ibiza > Thanks! :)
I think it's somewhat stupid to have designed it that way (different behaviour for label and for textbox), but anyway... |
|||||||||||||||||||||||