Solved

Get the label name with Javascript/ASP.Net

Posted on 2007-04-04
2
453 Views
Last Modified: 2008-02-01
This is related to the question i asked here but i closed that question:
http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_22490183.html

I have a label with id="lblHPhone" and text="Home Phone"
I want to get the text and tried this:
  var test = document.getElementById('<%= Page.Master.FindControl("ContentPlaceHolder1").FindControl("lblHPhone").ClientID %>');
        alert(test.value);

But I get "undefined" for that...how can I get the label name??
0
Comment
Question by:Camillia
2 Comments
 
LVL 17

Accepted Solution

by:
gops1 earned 500 total points
Comment Utility
Try

var test = document.getElementById('lblHPhone').innerHTML;
alert(test);
0
 
LVL 10

Expert Comment

by:Jaax
Comment Utility
How is your label defined ?
Something like this:
<input type="text" name="lblHPhone" id="lblHPhone">  ?

Also ensure that there is only one element with the name lblHPhone
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now