GridView中使用CheckBox

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;
            
        }

【推广】 免费学中医,健康全家人
原文地址:https://www.cnblogs.com/llguanli/p/8428170.html