62,046
社区成员
发帖
与我相关
我的任务
分享
<table class="table1">
<asp:Repeater runat="server" ID="rptItemlist">
<ItemTemplate>
<tr>
<td class="td1">
<span style="color: #FF001E">*</span>
<%#Eval("sn")%>
</td>
<td class="td2">
<span>
<%#Eval("ItemTitle")%></span>
</td>
<td class="td3">
<asp:RadioButtonList ID="RadioButtonList1" RepeatDirection="Horizontal" runat="server" CssClass="radio">
<asp:ListItem Value="5">5</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="1">1</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
<asp:Repeater runat="server" ID="rptItemlist">
<ItemTemplate>
<tr>
<td class="td1">
<span style="color: #FF001E">*</span>
<%#Eval("sn")%>
</td>
<td class="td2">
<span>
<%#Eval("ItemTitle")%></span>
</td>
<td class="td3">
<asp:RadioButtonList ID="RadioButtonList<%#Eval("sn")%>" RepeatDirection="Horizontal" runat="server" CssClass="radio">
<asp:ListItem Value="5">5</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="1">1</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
你绑定的时候把题号绑定到 RadioButtonList 的ID 上不就好弄了。
<table class="table1">
<tbody>
<tr>
<td class="td1">
<span style="color: #FF001E">*</span> 1.1
</td>
<td class="td2">
<span>标题1</span>
</td>
<td class="td3">
<table id="RadioButtonList1" class="radio">
<tbody>
<tr>
<td>
<input id="RadioButtonList1_0" type="radio" checked="checked" value="5" name="RadioButtonList1">
<label for="RadioButtonList1_0">
5</label>
</td>
</tr>
....
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
通过 jQuery("table.table1 tr").each(function (i, item) {
if (jQuery(item).find("input[type='radio']:checked").length <= 0) {
_obj = jQuery(item).find("input[type='radio']").eq(0);
_message = jQuery(item).find("td").eq(0).text() + "没有勾选!";
jQuery(item).addClass("red");
return false;
}
jquery找到的tr也包含了<table id="RadioButtonList1" class="radio">
中的,因此_message = jQuery(item).find("td").eq(0).text() + "没有勾选!";提示的信息 除了序号外 也包含了radiobutton的value,而我只想要序号的值