473,397 Members | 2,033 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,397 software developers and data experts.

setvalue of asp:Label with JavaScript

Hi,

Can anyone tells me how can I set value of asp:Label field with JavaScript?

Anton, ml.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.583 / Virus Database: 369 - Release Date: 10.2.2004
Nov 18 '05 #1
5 7736
Basically I want to get some values from client browser and use/write them
in my asp:label.

Anton, ml.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.583 / Virus Database: 369 - Release Date: 10.2.2004
Nov 18 '05 #2
Dan
How about creating a cookie using javascript and then picking this up using
your code behind?

"Anton ml. Vahčič" <an**********@campus.fri.uni-lj.si> wrote in message
news:uW**************@TK2MSFTNGP12.phx.gbl...
Basically I want to get some values from client browser and use/write them in my asp:label.

Anton, ml.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.583 / Virus Database: 369 - Release Date: 10.2.2004

Nov 18 '05 #3
Hi,

That's good idea, but I don't want to have cookies behind my code... I
read somewhere that it can be done with RegisterHiddenField. I create a
hiddenfield even change value, but then how I read hidden field back to my
variable in asp.net program... Examples about it are not too perfect in MS
documentation.

Anton, ml.

"Dan" <da*@dontspam.com> wrote in message
news:u1**************@TK2MSFTNGP11.phx.gbl...
How about creating a cookie using javascript and then picking this up using your code behind?

"Anton ml. Vahčič" <an**********@campus.fri.uni-lj.si> wrote in message
news:uW**************@TK2MSFTNGP12.phx.gbl...
Basically I want to get some values from client browser and
use/write them
in my asp:label.

Anton, ml.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.583 / Virus Database: 369 - Release Date: 10.2.2004



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.583 / Virus Database: 369 - Release Date: 10.2.2004
Nov 18 '05 #4
Hello Anton,

I believe you have to something like this:

var elMyElement = document.getElementByID("ElementName");

elMyElement.innerHTML = "your text here";

Adam

"Anton ml. Vahčič" <an**********@campus.fri.uni-lj.si> wrote in message news:<u2**************@TK2MSFTNGP10.phx.gbl>...
Hi,

Can anyone tells me how can I set value of asp:Label field with JavaScript?

Anton, ml.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.583 / Virus Database: 369 - Release Date: 10.2.2004

Nov 18 '05 #5
"Dan" <da*@dontspam.com> wrote in message news:<u1**************@TK2MSFTNGP11.phx.gbl>...
How about creating a cookie using javascript and then picking this up using
your code behind?

"Anton ml. Vahčič" <an**********@campus.fri.uni-lj.si> wrote in message
news:uW**************@TK2MSFTNGP12.phx.gbl...
Basically I want to get some values from client browser and use/write

them
in my asp:label.

Anton, ml.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.583 / Virus Database: 369 - Release Date: 10.2.2004


<form id="frmMain" method="post" runat="server">
<asp:Label ID="lbl" Runat="server"></asp:Label>
</form>
private void Page_Load(object sender, System.EventArgs e)
{
this.RegisterStartupScript("initLabel", "<script>document.all['" +
lbl.ClientID + "'].innerText='some value';</script>");
}
Nov 18 '05 #6

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...
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...
3
by: nick | last post by:
Is possible for server side code to access the text of <asp:label> changed by client side javascript code?
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: richard | last post by:
I have a function Message_Show: Public Sub Message_Show(ByVal sLabel As Label, ByVal sButton As Button, ByVal sMessage As String, ByVal sButtonText As String) If (IsPostBack) Then sLabel.Text =...
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: 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: Bob | last post by:
When I use an ASP:Label with runat="server", and in JavaScript I use innerText on the ASP:Label, the Text property is not reflected in an event postback on the form. ASP:TextBox is not an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.