헤더에 체크 박스가있는 목록보기가 있습니다. 헤더 체크 박스가 선택/선택 해제되어있는 경우 행의 모든 체크 박스를 선택하고 싶습니다. 클라이언트 측에서 어떻게 이것을 할 수 있습니까? 다음은 ListView 디자인 코드입니다.자바 스크립트를 사용하여 클라이언트 측 목록보기의 모든 체크 박스를 선택하십시오.
<asp:ListView ID="lvTypes" runat="server" GroupPlaceholderID="groupPlaceHolder1" ItemPlaceholderID="itemPlaceHolder1">
<LayoutTemplate>
<div id="DataTables_Table_0_wrapper" class="dataTables_wrapper" role="grid">
<table id="DataTables_Table_0" class="table table-striped table-bordered bootstrap-datatable datatable responsive dataTable" aria-describedby="DataTables_Table_0_info">
<thead class="box-header well" style="font-size: 12px !important;">
<tr role="row">
<th class="sorting_asc" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" style="text-align: center; width: 50px;" aria-sort="ascending" aria-label="SNo: activate to sort column descending">S.No
</th>
<th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" style="text-align: center; width: 188px;" aria-label="Name: activate to sort column ascending">Name
</th>
<th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" style="text-align: center; width: 200px;" aria-label="Action: activate to sort column ascending">
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" OnCheckedChanged="chkSelectAll_CheckedChanged" Text="Action"/>
</th>
<th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" style="text-align: center; width: 188px;" aria-label="Employee ID: activate to sort column ascending">Desription
</th>
</tr>
</thead>
<tbody role="alert" aria-live="polite" aria-relevant="all">
<asp:PlaceHolder runat="server" ID="groupPlaceHolder1"></asp:PlaceHolder>
</tbody>
</table>
</div>
</LayoutTemplate>
<GroupTemplate>
<tr>
<asp:PlaceHolder runat="server" ID="itemPlaceHolder1"></asp:PlaceHolder>
</tr>
</GroupTemplate>
<ItemTemplate>
<td style="text-align: center;">
<%# Container.DataItemIndex + 1 %>
</td>
<td style="text-align: center;">
<asp:CheckBox ID="cbDelProjectType" Checked="false" runat="server" />
<a class="iframe2 cboxElement" href='<%# ResolveUrl("./Admin_EditPage.aspx?editTemplateId="+ Eval("id").ToString()) %>'>
<img src="./images/file_edit.png" alt="Edit Type" width="20px" height="20px" />
</a>
</td>
<td style="text-align: center;">
<%# Eval("title") %>
</td>
<td style="text-align: center;">
<%# Eval("description") %>
</td>
</ItemTemplate>
</asp:ListView>
"CS0103 : 이름"CheckBox1 "이 현재 컨텍스트에 존재하지 않습니다. 위에서 CheckBox 컨트롤과 javascript 함수 모두에 대해 정확한 코드를 복사했지만 : S – WAQ
죄송합니다. 실제로는 * * Checkbox1 **는 ** ListView ** 안에 있으므로'$ ("# # % = CheckBox1.ClientID %>")'를'referance '로 사용하면 문맥 오류가 발생합니다. – Prabhat
이제는 checkBox 선언에서 오류가 발생합니다. "예상 됨"이라고합니다.) – WAQ