asp:label updated via javascript does not get its value saved in the viewstate

I

ibiza

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
 
E

Eliyahu Goldin

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
 
I

ibiza

Thanks! :)

I think it's somewhat stupid to have designed it that way (different
behaviour for label and for textbox), but anyway...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top