here this is my html markup :
(这是我的html标记:)
<asp:TemplateField>
<HeaderTemplate>
<div class="form-check">
<input type="checkbox" id="chkAll" runat="server" class="form-check-input checkAll" onclick="javascript: form1.submit();" onserverchange="Server_Changed" />
<label class="form-check-label">Roll No</label>
</div>
</HeaderTemplate>
<ItemTemplate>
<div class="form-check">
<input type="checkbox" id="chkSelect" runat="server" class="form-check-input" />
<label class="form-check-label">
<asp:LinkButton runat="server" CausesValidation="false" ID="lnkID" CommandName="detail"
CommandArgument='<%#Bind("ID") %>' ToolTip="View Detail"
Text='<%# string.Concat("#",Eval("RollNo"))%>'
Font-Underline="true">
</asp:LinkButton>
</label>
</ItemTemplate>
</asp:TemplateField>
and here is my code :
(这是我的代码:)
protected void Server_Changed(object sender, EventArgs e)
{
CheckBox chkAll = sender as CheckBox;
if (chkAll.Checked)
{
for (int i = 0; i <= egrd.Rows.Count - 1; i++)
{
GridViewRow row = egrd.Rows[i];
CheckBox Ckbox = (CheckBox)row.FindControl("chkSelect");
Ckbox.Checked = true;
}
}
else
{
for (int i = 0; i <= egrd.Rows.Count - 1; i++)
{
GridViewRow row = egrd.Rows[i];
CheckBox Ckbox = (CheckBox)row.FindControl("chkSelect");
Ckbox.Checked = false;
}
}
}
here i achieve get all checkbox selected from html checkbox checked changed event..
(在这里,我实现了从html复选框选中已更改事件中获取所有复选框。)
how i done this task ...please guys help me...
(我是如何完成这项任务的...请大家帮我...)
ask by shalin gajjar translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…