473,799 Members | 3,085 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting the Value of a Label with Javascript

2 New Member
How can a value be set to a label in javascript.

I can set values to <h6> tags, but I need to set the value of a label. Particularly becasue I can't seem to acces the value of an <h6> tag in the aspx.vb code-behind on the aspx page.

So far I got the changing of <h6> values working by doing this:

Expand|Select|Wrap|Line Numbers
  1. function SellLots_DoFSCommand(command, args){
  2.                         if(args != "" && args != null)
  3.                         {
  4.                             document.getElementById("Selection").innerHTML = "Lot#" + command + " is currently " + args;
  5.                             document.getElementById("Status").innerHTML = args;
  6.                             document.getElementById("LotId").innerHTML = command;          
  7.                         }
Unfortunatly, that doesn't help me, so I need to set the value of an <asp:label> so I can access it.

I've already tried the following and it doesn't set the value of the label "label2":

Expand|Select|Wrap|Line Numbers
  1. function SellLots_DoFSCommand(command, args){
  2.                         if(args != "" && args != null)
  3.                         {
  4.                             document.getElementById("Selection").innerHTML = "Lot#" + command + " is currently " + args;
  5.                             document.getElementById("Status").innerHTML = args; 
  6.                             document.getElementById("LotId").innerHTML = command;  
  7.                             document.getElementById("label2").innerText = "Hello!";         
  8.                         }
It works with all of the <h6> as before, but the last one (label2) is the one I can't seem to figure out how to set the value of.

I'd appreciate any help that anyone might be able to offer!
Nov 10 '07 #1
1 2244
acoder
16,027 Recognized Expert Moderator MVP
Look at the source (in the browser) and see what the ID of the <asp:label> is and use that.
Nov 10 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

12
1966
by: daniel kaplan | last post by:
Hi All, Been learning Javascript (via google) to create forms with pre-set values. As seen below. My problem I have found is this: I can't seem to figure out (or find so far via google) how to preset form options when the input type is a radio button, or dropdown list. The same method does not seem to work with input fields. Anyone know of such a comprehensive site?
1
3441
by: MickG | last post by:
I am trying to change the value of the variable "hard" according to which radio button is pressed and I am having no joy. Could anyone help me with this, the problematic section is marked with ***********************, I've included all the code incase that isn't where the problem is. Any help would be hugely appreciated. Mick
1
1374
by: Mike | last post by:
Hi, I am developing a JavaScript calendar control. I want my user control to expose a property that returns the value of the selected calendar date. I have an "input" control that displays the selected date. I also tried to add a Label server-side control, but I am unable to set its value through Javascript. <form id="mainForm" name="mainForm" action="" method="post"> <p>
2
1973
by: jason | last post by:
Hello and Good Day. REALLY LOST. Running ASP.NET 1.1 Becuase I think I'm using my own controls smartnavigation does not appear to work for me. Stardard issue: I've got a datagrid thats displaying pages and pages of rows. When I edit some row below pages 1 the post refreshes back to page one, requiring me to page down to do the input.
0
10484
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10251
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10027
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9072
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.