Click here to Skip to main content
15,795,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Getting the value of Label inside
gridview itemtemplete Using jQuery in asp.net


<asp:TemplateField Visible="False">
                     <ItemTemplate>
                         <asp:Label ID="lbl_ParentID" runat="server" Text='<%# Bind("ParentID") %>'></asp:Label>
                     </ItemTemplate>
Posted
Updated 7-Aug-12 0:32am
v2
Comments
Sibasisjena 7-Aug-12 5:37am    
Can you please check the class or id of that label after rendering ?
ZurdoDev 7-Aug-12 8:20am    
View the source to see what is it named or wrap it in a div or assign a class to make it easier to find.

1 solution

Try like this

XML
<script type="text/javascript">
        function getValue() {
var GridView1= document.getElementById("<%= GridView1.ClientID %>");
            var val = $(GridView1).children("span").get(0).innerHTML;
            alert(val);
        }
    </script>


or


$("input[id$=lbl_ParentID]").val();
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900