0
我已經制作了一張如下表格。jquery在asp.net的html表格中獲取帶有複選框的行mvc
<div class="grid_top_button">
<div class="left_top_curve">
</div>
<div class="right_top_curve">
</div>
<input name="input" type="button" id="addSelected" name="addSelected" class="section_btn"
value="Link" /></div><table id="LstDocTemp" border="0" cellpadding="0" cellspacing="0" class="instruction_grid">
<tr>
<th align="left" class="ins_sl_no">
Sl No.
</th>
<th align="left" class="selct_column">
<input type="checkbox" id="chkSelectAll" name="chkSelectAll" />
</th>
<th align="left" class="doc_title_1">
Document title
</th>
<th align="left" class="description">
Description
</th>
<th align="center" class="revision">
Revision
</th>
<th align="left" class="part_no">
Parts name
</th>
<th align="center" class="issue_no">
Issue
</th>
<th align="center">
Link
</th>
</tr>
<% int slNo = 1; %>
<%foreach (var item in Model)
{ %>
<tr id="<%= Html.Encode(item.DocId) %>">
<td>
<%= slNo %>
</td>
<td>
<input type="checkbox" name="chkItem" class="chk" id="chkbox_<%=Html.Encode(item.DocId) %>" />
</td>
<td>
<%= Html.Hidden("DocTitle", item.DocTitle)%>
<a href='<%= Url.Action("DetailsDocumentTemplate", "Document", new { id = item.DocId })%>'>
<%=Html.Encode(item.DocTitle) %></a>
</td>
<td>
<%= Html.Hidden("DocDesc", item.DocDesc)%>
<%= Html.Encode(item.DocDesc) %>
</td>
<td class="dark_highlight">
<%= Html.Hidden("DocRevision", item.DocRevision)%>
<%= Html.Encode(item.DocRevision) %>
</td>
<td>
<%= Html.Hidden("PartListId", item.PartListId)%>
<%= Html.Hidden("PartNo", item.PartNo)%>
<%= Html.Encode(item.PartNo) %>
</td>
<td class="light_highlight">
<%= Html.Hidden("IssueNo", item.IssueNo)%>
<%=Html.Encode(item.IssueNo) %>
</td>
<td>
<%= Html.Hidden("DocId", item.DocId)%>
<a class="icon_add" title="Add">Add</a>
</td>
</tr>
<%slNo++;
} %>
</table>
我需要實現follwing:
- 在控制器執行操作用於由勾選複選框(
name="chkItem"
)選擇的行。 - 選中複選框(
name="chkSelectAll
)時,選中/取消選中checkboes(name="chkItem"
)。 - 通過檢查chkSelectAll複選框選中全部並取消選中任何人後,應取消選中chkSelectAll複選框。
什麼是你的問題?在嘗試實現您可能想要詢問的要求時可能遇到的任何特定問題? – 2011-01-27 07:18:31
我已將我的問題移至 http://stackoverflow.com/questions/4813610/jquery-checkbox-manipulation-within-a-foreach-loop – 2011-01-27 08:43:35