首页 > 其他 > 详细

GridView中使用CheckBox

时间:2018-02-07 21:07:06      阅读:169      评论:0      收藏:0      [点我收藏+]

asp.net中checkbox是向server提交时才干触发事件

把该控件的autopostback设置为true。才干响应事件


?protected void Checkbox_CheckedChanged1(object sender, EventArgs e)
? ? ? ? {
? ? ? ? ? ? string id = string.Empty;
? ? ? ? ? ? foreach (GridViewRow gr in this.newsTable.Rows)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? CheckBox CB = (CheckBox)gr.FindControl("ChkItem");
? ? ? ? ? ? ? ? if (CB.Checked)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? id += this.newsTable.DataKeys[gr.RowIndex]["InfoTableOID"].ToString();
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ? this.hidden.Value = id;
? ? ? ? ? ??
? ? ? ? }

GridView中使用CheckBox

原文:https://www.cnblogs.com/llguanli/p/8428170.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!