How to access the value of the Label present inside Datagrid asp.net using jquery?

Posted by vini on Stack Overflow See other posts from Stack Overflow or by vini
Published on 2012-10-17T16:32:07Z Indexed on 2012/10/17 17:01 UTC
Read the original article Hit count: 236

Filed under:
|
|
|
 <asp:DataGrid ID="datagrid1" runat="server" AutoGenerateColumns="False" Width="100%"
                    DataKeyField="Expr1" OnItemCommand="datagrid1_ItemCommand" EmptyDataText="No Records Found" 
                    >
                    <HeaderStyle BackColor="#2E882E" Font-Bold="True" ForeColor="#FFFFCC" HorizontalAlign="Left" />
                    <Columns>
                        <asp:TemplateColumn HeaderText="">
                            <ItemTemplate>
                                <table>
                                    <tr>
                                         <td class="style1">
<asp:Label ID="lblStatus" runat="server" Text='<%# Eval("Status") %>'></asp:Label>
                                        </td>
  </tr>
                                </table>
                            </ItemTemplate>
                        </asp:TemplateColumn>
                    </Columns>
                </asp:DataGrid>

How can i access this Status Label value using jquery Please help

   var DataGrid1 = $("<%=datagrid1.ClientID %>");
var status = $(DataGrid1).children("lblStatus").get(0).innerHTML;

Will the above code work?

© Stack Overflow or respective owner

Related posts about c#

Related posts about jQuery