动态生成checkbox,怎么判断是否选中 急急急急急

cuiguangh 2011-07-13 02:25:33
/// <summary>
/// 自动生成复选按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void gridTb_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType != DataControlRowType.DataRow)
{
return;
}
else
{
bool cellChecked = true; //默认全选状态
string key = gridTb.PageIndex + "_" + e.Row.RowIndex;
if (checkList.ContainsKey(key))
{
cellChecked = checkList[key];
}
checkList.Add(key, cellChecked);
Label l = new Label();
l.Text = e.Row.Cells[0].Text;
CheckBox c = new CheckBox();
c.Checked = cellChecked;
e.Row.Cells[0].Controls.Add(c);
//e.Row.Cells[0].Controls.Add(l);
}
}
private Dictionary<string, bool> checkList = new Dictionary<string, bool>();
...全文
41 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
挨踢直男 2011-07-13
  • 打赏
  • 举报
回复
在服务器端还是在浏览器?

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧