473,405 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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

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

Feb 28 '06 #1
2 1505
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" <la******@gmail.com> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.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

Feb 28 '06 #2
Thanks! :)

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

Feb 28 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Dwizz | last post by:
Hello, I really hope that someone can help me resolve my problem, I've been working on it for the past few days, to no avail. I have an asp:label which gets its value from the database, but what...
5
by: Anton ml. Vahčič | last post by:
Hi, Can anyone tells me how can I set value of asp:Label field with JavaScript? Anton, ml. ---
3
by: Harry | last post by:
Hi, Can anyone tell me why the below code does not work. I dont get any errors, but nor does the Text for the asp:label get set. Thanks in advance as always H
2
by: John Holmes | last post by:
I would like to turn on a label control in javascript with the onfocus event of another control by setting the Visible property to true. When I try and reference this label control it says...
2
by: tshad | last post by:
Is there another way to put labels on a page other than asp:label? I have been building a page where I use a label to display the calculated result of some imput. I do it using Javascript. But...
1
by: nospamjac | last post by:
Hi, Is there a way to update the text of an asp:label on a webform without refreshing the entire page? What is called by button clicks and other events that refresh a webform control? See the...
1
by: alien_attack | last post by:
I have the a repeater which is databound to an XmlDatasource. Inside the repeater is a Label as follows: <asp:Label ID="lbl" runat="server" Text='<%# XPath("Asset_Metadata/@Value")%>' /> ...
0
by: Dhananjay | last post by:
hi all i have a problem on populating a message on asp:label server control.I am able to insert records into the table.but it is not populating any message like "Records entered successfully"....
2
by: pavankumar106 | last post by:
can anyone tell me how to get the value of asp:label in javascript?
0
by: pavankumar106 | last post by:
can anyone tell me how to get the value of asp:label in javascript.. the label is in datalist and i need the value of it?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.