473,386 Members | 1,841 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,386 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 1986
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.