Solved

Get the label name with Javascript/ASP.Net

Posted on 2007-04-04
2
457 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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Thoughout my experience working on eCommerce web applications I have seen applications succumbing to increased user demand and throughput. With increased loads the response times started to spike, which leads to user frustration and lost sales. I ha…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

696 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