目的  通过绑定查询出来结果 双击每行可以看明细问题1、写在这个事件里对嘛?
问题2、如何得到id,我id 在页面显示了的。  protected void GridView1_RowDataBound1(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowIndex != -1)
        {
         //下面程序如何才能得到id数值?不是序号
          string id = e.Row.RowIndex.ToString();
         ..............
         }     }

解决方案 »

  1.   

     string id = GridView1.Rows[e.Row.RowIndex].Cells[1].Value.ToString();提示错误:::编译器错误信息: CS0117: “System.Web.UI.WebControls.TableCell”并不包含“Value”的定义
      

  2.   

    string id = GridView1.Rows[e.Row.RowIndex].Cells[1].Text.ToString(); 
      

  3.   

    “/”应用程序中的服务器错误。
    --------------------------------------------------------------------------------索引超出范围。必须为非负值并小于集合大小。
    参数名: index 
    说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.ArgumentOutOfRangeException: 索引超出范围。必须为非负值并小于集合大小。
    参数名: index源错误: 行 33:             string id = GridView1.Rows[e.Row.RowIndex].Cells[1].Text.ToString();