Solved

Get the label name with Javascript/ASP.Net

Posted on 2007-04-04
2
458 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

by:
gops1 earned 500 total points
ID: 18850640
Try

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

Expert Comment

by:Jaax
ID: 18850653
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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 article discusses how to implement server side field validation and display customized error messages to the client.
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…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…

726 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