富贵资源网 Design By www.hznty.com
1、GridView的列设置
复制代码 代码如下:
<asp:TemplateField HeaderStyle-CssClass="check" ItemStyle-CssClass="check">
<HeaderTemplate>
<input type="checkbox" onclick="selectAll(this)" />
全选
</HeaderTemplate>
<ItemTemplate>
<input name="chkIDCardNum" type="checkbox"
value="<%# Eval("PID") %>$<%# Eval("IdentityCard")%>$<%# Eval("PName")%>"
<%# "1" == Eval("IsCouldDelete").ToString()?"disabled='disabled'":""%> />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="true" HeaderText="删除">
<ItemTemplate>
<asp:LinkButton id="lbtnDelete" CommandName="lbtnDelete" runat="server" Text="删除档案"
CommandArgument='<%# Eval("PID") +"$"+ Eval("IdentityCard")%>'
OnClientClick="return confirm('确认删除?');"
Visible='<%# Eval("Termination").ToString()=="1" ? false : true %>' />
</ItemTemplate>
</asp:TemplateField>
2、全选的Js处理
复制代码 代码如下:
function selectAll(myself) {
var oState = myself.checked;
var checkboxes = document.getElementsByName("chkIDCardNum"); //获取input组
for (var i = 0; i < checkboxes.length; i++) {
if (checkboxes[i].disabled) {
} else {
checkboxes[i].checked = oState; //选择值
}
}
}
3、后台对所选值的获取
复制代码 代码如下:
var selectedIds = Request.Params["chkIDCardNum"].Split(',');
if (selectedIds.Length == 0)
return;
//int[] msgIds = Array.ConvertAll<string, int>(selectedIds, s => int.Parse(s));
int[] ids = selectedIds.Select(t => int.Parse(t.Split('$')[0])).ToArray();
string[] cards = selectedIds.Select(t => t.Split('$')[1]).ToArray();
复制代码 代码如下:
<asp:TemplateField HeaderStyle-CssClass="check" ItemStyle-CssClass="check">
<HeaderTemplate>
<input type="checkbox" onclick="selectAll(this)" />
全选
</HeaderTemplate>
<ItemTemplate>
<input name="chkIDCardNum" type="checkbox"
value="<%# Eval("PID") %>$<%# Eval("IdentityCard")%>$<%# Eval("PName")%>"
<%# "1" == Eval("IsCouldDelete").ToString()?"disabled='disabled'":""%> />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="true" HeaderText="删除">
<ItemTemplate>
<asp:LinkButton id="lbtnDelete" CommandName="lbtnDelete" runat="server" Text="删除档案"
CommandArgument='<%# Eval("PID") +"$"+ Eval("IdentityCard")%>'
OnClientClick="return confirm('确认删除?');"
Visible='<%# Eval("Termination").ToString()=="1" ? false : true %>' />
</ItemTemplate>
</asp:TemplateField>
2、全选的Js处理
复制代码 代码如下:
function selectAll(myself) {
var oState = myself.checked;
var checkboxes = document.getElementsByName("chkIDCardNum"); //获取input组
for (var i = 0; i < checkboxes.length; i++) {
if (checkboxes[i].disabled) {
} else {
checkboxes[i].checked = oState; //选择值
}
}
}
3、后台对所选值的获取
复制代码 代码如下:
var selectedIds = Request.Params["chkIDCardNum"].Split(',');
if (selectedIds.Length == 0)
return;
//int[] msgIds = Array.ConvertAll<string, int>(selectedIds, s => int.Parse(s));
int[] ids = selectedIds.Select(t => int.Parse(t.Split('$')[0])).ToArray();
string[] cards = selectedIds.Select(t => t.Split('$')[1]).ToArray();
富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com
暂无评论...