Click here to Skip to main content
11,802,389 members (30,802 online)
Rate this: bad
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 22:07pm
Edited 5-Nov-12 22:27pm
Neelam Chandra (8015059) at 6-Nov-12 4:14am
why u putting your lable inside table tag it would be easier if you format tag only
Yvonne192 at 6-Nov-12 4:17am
i need both table and label inside gridview
Sanjay K. Gupta at 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
0 OriginalGriff 435
1 KrunalRohit 366
2 F-ES Sitecore 295
3 Afzaal Ahmad Zeeshan 230
4 CHill60 220
0 OriginalGriff 2,950
1 Maciej Los 1,910
2 KrunalRohit 1,862
3 CPallini 1,645
4 Richard MacCutchan 1,157

Advertise | Privacy | Mobile
Web02 | 2.8.151002.1 | 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