我点击GridView中某行的查看按钮
  就获取这行的信息
    请问怎么获取啊 ???

解决方案 »

  1.   

    一般是先选中行,然后对行进行操作。
    有许多方法可以选择。http://topic.csdn.net/u/20090819/14/3c30eda5-1c6d-498a-a636-be95ad5bd894.html
    参考
      

  2.   

    i为索引,比如要获取第二行,第三列的值gvTest.Rows[1].Cells[2].Text;因为是索引所以 数据位置要 -1,第二行,索引就是1,第三列,索引就是2
      

  3.   

    //GridView綁定行事件
        protected void gvArea_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Cells[1].Attributes.Add("onclick", "javascript:show(" + e.Row.RowIndex.ToString() + ")");
                e.Row.Cells[2].Attributes.Add("onclick", "javascript:show(" + e.Row.RowIndex.ToString() + ")");
                e.Row.Cells[3].Attributes.Add("onclick", "javascript:show(" + e.Row.RowIndex.ToString() + ")");
                e.Row.Cells[4].Attributes.Add("onclick", "javascript:show(" + e.Row.RowIndex.ToString() + ")");//#C7E1F8
                e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#bdddfc'");
                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
            }
        }这里你可以填入主键,然后通过JS事件传给需要的页面  或  其他地方有了主键  还有什么拿不到的??呵呵
      

  4.   

    看你代码如何定义了:
    常用三种用法:
    1、若在DATAKEYSNAME里定义了该列。则可THIS.Gridview1.datakeys[e.rowindex][索引].Text.
    2、THIS.GRIDVIEW1.rows[e.rowindex].cells[你想要的列对应的索引].Text.
    3、若对应的列是模版列,可((控件类型)THIS.GRIDVIEW1.rows[e.rowindex].FINDCONTROL("列对应的控件ID")).Text/value(HTML控件)
      

  5.   

    gvStoneStock.Rows[i].Cells[i].Text 可以的