我的模板中每个Tr
都有一个隐藏字段:
<ItemTemplate>
<tr style="" class="ui-selectee trClass ui-widget-content">
<td style="width: 100px">
<asp:HiddenField ID="idField" runat="server" Value='<%# Eval("Id") %>' />
<asp:Label ID="IdLabel" runat="server" Text='<%# Eval("Id") %>' />
</td>
<td>
<asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
</td>
<td>
<asp:Label ID="EmailLabel" runat="server" Text='<%# Eval("Email") %>' />
</td>
</tr>
</ItemTemplate>
不,在所选each
的{{1}}循环中,如何获取隐藏字段?
Tr
我已经开始:
$(".ui-selected", this).each(function () {
var index = $(".selectable tr").index(this);
var idField = ??
});
但似乎不起作用!
任何帮助!
答案 0 :(得分:1)
var id = $('tr.ui-selectee td input[type="hidden"]').val();
答案 1 :(得分:0)
试试这个......
$(".ui-selected", this).each(function () {
var index = $(this).find('#idField').val();// use common class for hidden field,that would be good.
alert(index );
});