Click here to Skip to main content
11,924,487 members (54,283 online)
Rate this:
Please Sign up or sign in to vote.
Hi everyone..
I have a tircky question to ask..
I want to get the ID of the ASP control inside a table and the table is inside a gridview...
Here's the code to give you a better idea...
<asp:GridView ID="gvTest" runat="server">
                        <table width="100%">
                                <td><asp:Label ID="lblTestLabel" runat="server"></asp:Label></td>
I have no problem getting the control inside a gridview and here's the code
function TestFunction(sender, e)
     var gridview = document.getElementById('gvTest.ClientID');
     var i = gridview.rows.length - 1;
     var node1 = gridview.rows[i].cells[1].children[0];
But i need to put table inside gridview for formatting issues and when i did it, the controls are not accessible ....
So my question is how can i get the ID of the ASP label (in this case, lblTestLabel") in javascript??
Answers and suggestions are very much appreciated..
Posted 5-Nov-12 23:07pm
Edited 5-Nov-12 23:27pm
Neelam Chandra (8015059) 6-Nov-12 4:14am
why u putting your lable inside table tag it would be easier if you format tag only
Yvonne192 6-Nov-12 4:17am
i need both table and label inside gridview
Sanjay K. Gupta 6-Nov-12 4:32am
But why you need both table and label

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Hi guys.. Problem solved now using :
var value = $('[id$=lblTestLabel]').val(); 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151125.3 | Last Updated 22 Oct 2014
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100