Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9323865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T04:27:05+00:00 2026-06-19T04:27:05+00:00

I have a Label control within a GridViewRow cell, that I need to access

  • 0

I have a Label control within a GridViewRow cell, that I need to access from the client side using Javascript. I can access the GridView row fine, but I can’t for the life of me work out how to access the Label within it.

Layout:

<asp:TemplateField>
    <ItemTemplate>
        <asp:Label ID="link_lbl" runat="server" Visible="false" Text='<%# BIND("link") %>'></asp:Label>
    </ItemTemplate>
</asp:TemplateField>

Javascript:

var gridview = document.getElementById("<%= list_gv.ClientID %>");
for (i = 1; i < gridview.rows.length; i++) {
    var label = gridview.rows[i].cells[0].?????
}

I’ve tried various things where the ????? is, but can’t get to the Label control to read from it!

Any ideas please?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T04:27:06+00:00Added an answer on June 19, 2026 at 4:27 am

    Try this code

    var gridview = document.getElementById("<%= list_gv.ClientID %>");
    for (i = 1; i < gridview.rows.length; i++) {
        var labels = gridview.rows[i].cells[0].getElementsByTagName("span");
         alert(labels[0].innerHTML);
    }
    

    This will give you the first label text in cell[0].
    You can also directly get by using label id.

    var gridview = document.getElementById("<%= list_gv.ClientID %>");
    for (i = 1; i < gridview.rows.length; i++) {
        var RowNumber=(i+1).toString();
        if (i<10)
        RowNumber="0"+(i+1).toString();
        var label =  document.getElementById(gridview.id.toString()+"_ctl" + RowNumber + "_link_lbl");
        alert(label.innerHTML);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a repeater control that contains an ItemTemplate containing a databound label and
I have a user control that contains multiple controls (CheckBox, Button, Label...). I want
I have a situation where I need to access an object that has been
Using jQuery 1.6.1 , given I have the following HTML: <div class=control> <label>My Control</label>
I do have a control template for WPF button. Within the template I can
i am trying access an asp label within an asp repeater from my code
Say I have a label control in Winforms and I want to do some
I use ASP.NET and have a label control on my page, which I fill
I have an updateprogress in my aspx file, which has a label control in
I have created a user control (link) which has a label and a button.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.