protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
CheckBox cb = e.Row.FindControl("CheckBox1") as CheckBox;
//根据数据库的值设置CheckBox是否为选中状态
}
}
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
CheckBox cb = sender as CheckBox;
//根据CheckBox的选中状态执行数据库操作
}
不知是否能满足你的需求
还是自己写列吧,自动生成的不好写样式