如题。想实现这样的效果。
gridview有很多行,如何实现单击某一行的某一列时,该列自动变成文本编辑状态,其他列都不能编辑。(注明:不用gridview自带的编辑按钮)
比如:gridview有如下行列
A列 B列 C列 D列 E列 F列
1 2 3 4 5 6
11 22 33 44 55 66
111 222 333 444 555 666
。。
单击“22”时,自动编辑“22”所在这列 ,其他都不允许编辑。
gridview有很多行,如何实现单击某一行的某一列时,该列自动变成文本编辑状态,其他列都不能编辑。(注明:不用gridview自带的编辑按钮)
比如:gridview有如下行列
A列 B列 C列 D列 E列 F列
1 2 3 4 5 6
11 22 33 44 55 66
111 222 333 444 555 666
。。
单击“22”时,自动编辑“22”所在这列 ,其他都不允许编辑。
解决方案 »
- 只截取文章中的文字 而不截取图片等等?
- 关于页面载入时右侧的窗体
- 调用页面脚本与取得返回值难题,麻烦各位大大帮下忙,急待中
- 需要在前台datalist里面写个IF语句?
- 晕的 帮忙看下面的自定义控件的代码!谢谢拉
- 在DataGrid里超级链接列中传递多值的问题
- asp.net中操作服务器端的Excel文件,请高手帮忙..
- 新年好!先问个问题:win2000+asp.net+sqlserver2000,可sqlmangr.exe进程一直在向外发数据,弄得网站打不开,请问该怎么解决?
- 用企业邮箱做邮箱绑定功能的问题
- 怎样修改连接字符串的CONNECTION TIMEOUT属性!
- 数组赋值的怪异问题
- repeater嵌套问题?
然后通过JS事件去触发后台事件,使gvInfo.EditIndex=索引行,重新绑定
JS事件记得传对应行的索引,
1添加JS事件 aa(index);
2JS事件去触发一个Button事件,并把JS传过来的索引放到一个隐藏控件
3button事件实现gridview.editindex=隐藏控件的值
4重新绑定gridview
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
this.GridView1.EditIndex = e.NewEditIndex;
bind();
}
//更新完成后
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
Users us = new Users();
us.Id = int.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString());
us.Phone = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text;
us.Mail = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[6].Controls[0]).Text;
us.Address = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[5].Controls[0]).Text;
if (UserBll.UpdateUser(us)>0)
{
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "a", "alert('更新成功!')", true);
GridView1.EditIndex = -1;
bind();
}
else
{
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "s", "alert('更新失败!')", true);
}
}
//取消更新,将编辑行取消
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex = -1;
bind();
}你看行不行啊????
http://topic.csdn.net/u/20090828/14/032e32d3-a37b-4436-a48c-961bb4a53e85.html