分不多,但请求高人帮我解决一个 checkbox问题 你试试用GridView的索引的FindControl方法. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 具体代码在公司里,我明晚再详细说.先指定到你要编辑的那行,取它的索引.你的CheckBox是GridView1的一个编辑列吧.在"GridView1_editCommand(object sender, System.EventArgs e)"里你就能用e.Item.FindControl()来取值了.这些代码是我手写的,可能有误. 刚看到另一个帖里的(http://topic.csdn.net/u/20071025/16/d86c4dee-10e5-44b5-ab54-0a7d160e7056.html)如果是DataGrid的话: string id=""; for (int i=0;i <DataGrid1.Item.Count;i++) { CheckBox chk = (CheckBox)DataGrid1.Items[i].FindControl("chk"); if (chk.Checked) { id = DataGrid1.Items[i].Cells[1].Text; Response.Write("Delete:" + id.ToString(); } }我自己写的有点记不清了,明天去公司看了源代码再来回复. CheckBox CheckRow = (CheckBox)row.FindControl("CheckBox1"); 这里用了findcontrolstring sqlstr = "update tb_client set Crm_pid =( '" + TextBox4.Text + " ') where '" + CheckRow.Checked.Equals(true) + " '"; 这里为什么不用findcontrol呢?都是在gridview里边的吧?另外还有一个问题,你这个sql写出来是什么??update tb_client set Crm_pid ’aaa’ where 'true' 如何 获取 这段 字符串的 中间一串 请教一个关于aspnetdb.mdf的问题!~ 请教高手长文章分页问题 Repeater重写(有没有人会呀,两个帖子一起接) 网页前置 创建excel application出错 救急! 100分请教datagrid模板列写判断语句问题!!! ie浏览器中用Ftp上传得解决方案!activex 怎样显示点击按钮后,几秒之后页面转到另外一个页面? 一个服务器部署的问题 求一个VS2003的上传组件???
先指定到你要编辑的那行,取它的索引.
你的CheckBox是GridView1的一个编辑列吧.
在"GridView1_editCommand(object sender, System.EventArgs e)"里
你就能用e.Item.FindControl()来取值了.
这些代码是我手写的,可能有误.
如果是DataGrid的话:
string id="";
for (int i=0;i <DataGrid1.Item.Count;i++)
{
CheckBox chk = (CheckBox)DataGrid1.Items[i].FindControl("chk");
if (chk.Checked)
{
id = DataGrid1.Items[i].Cells[1].Text;
Response.Write("Delete:" + id.ToString();
}
}我自己写的有点记不清了,明天去公司看了源代码再来回复.
这里用了findcontrolstring sqlstr = "update tb_client set Crm_pid =( '" + TextBox4.Text + " ') where '" + CheckRow.Checked.Equals(true) + " '";
这里为什么不用findcontrol呢?
都是在gridview里边的吧?另外还有一个问题,你这个sql写出来是什么??
update tb_client set Crm_pid ’aaa’ where 'true'