如题。想实现这样的效果。

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”所在这列 ,其他都不允许编辑。
  

解决方案 »

  1.   

    rowdataboung添加JS事件
    然后通过JS事件去触发后台事件,使gvInfo.EditIndex=索引行,重新绑定
    JS事件记得传对应行的索引,
      

  2.   

    流程大概可以理解成这样
    1添加JS事件 aa(index);
    2JS事件去触发一个Button事件,并把JS传过来的索引放到一个隐藏控件
    3button事件实现gridview.editindex=隐藏控件的值
    4重新绑定gridview
      

  3.   

     //将选定的行设为编辑行
        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();
        }你看行不行啊????
      

  4.   

    双击编辑
    http://topic.csdn.net/u/20090828/14/032e32d3-a37b-4436-a48c-961bb4a53e85.html