This is an ascx page and the code is in aspx. It will show more than one datalist. How can I get the number of datalists in the page through JavaScript?
<asp:DataList ID="TF_DataList" runat="server" RepeatDirection="Vertical" OnItemCreated="TF_Datalist_ItemCreated">
<ItemTemplate>
<table style="text-align:left;">
<tr>
<td valign="top" align="left" nowrap="nowrap">
<asp:RadioButton ID="lbTrue" runat="server" GroupName="ans" Text="T" onclick="Radcheck();"
/>
<asp:RadioButton ID="lbFalse" runat="server" GroupName="ans" Text="F" onclick="Radcheck();"
/>
</td>
<td>
</td>
<td runat="server" id="AnswerContentTD" style="text-align: left">
<asp:Label ID="lblAnswerText" runat="server" Text='<%# Eval("AnswerText")%>'>
</asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left">
</ItemStyle>
</asp:DataList>
The best you can do is this work around. Give a
CssClass="mydatalist"to every datalist in your page. Please rememeber these things.asp:DataListmust have thisCssClassasp:DataListmust have thisCssClassJavascript implementation.
If you are using jQuery