For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > February 2006 > asp:label updated via javascript does not get its value saved in the viewstate









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

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

2006-02-28, 7:02 pm

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

Eliyahu Goldin

2006-02-28, 7:02 pm

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

"ibiza" <lambertb@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
>



ibiza

2006-02-28, 7:02 pm

Thanks! :)

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

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com