绑定按钮
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int rowindex = -1;
        if (e.CommandName == "update")
        {
            rowindex = Convert.ToInt32(e.CommandArgument);--报错获取的字符串格式不正确。哪里错了,请大家帮忙。            GridViewRow row = this.GridView1.Rows[rowindex];
            string id = row.Cells[0].Text;
            Response.Redirect("UserAdd.aspx?action=update");
        }
    }
       

解决方案 »

  1.   


     这样试试:
        1.Response.Write(e.CommandArgument);
          Response.End(); 看看输出的是什么东西
       
        2.把 rowindex = Convert.ToInt32(e.CommandArgument); 改成
             rowindex = Int.Parse(e.CommandArgument);
      利用OWC制作Excel中的柱形图、饼形图、折线图的源代码,绝对经典
       http://www.it846.com/chart
      

  2.   

    int a = Convert.ToInt32("abc");  //抛出异常,输入字符串的格式不正确。
    int a = Convert.ToInt32("123");  //结果:a = 123;说明e.CommandArgument无法转换成int型。看看对e.CommandArgument的赋值是否可以正确的转换成int型====>
    CSDN越改越差,回复一个帖子都这么累,老是出错,没反应。
      

  3.   

     rowindex = Convert.ToInt32(e.CommandArgument).tostring();
      

  4.   

    http://hi.baidu.com/jxchnew/blog/item/85ff28f4122af46fdcc47480.html
      

  5.   

    e.CommandArgument 不能被转化为 int 
      

  6.   

    你是想找当前行的索引号
    CommandArgument属性里要事先绑定其它列某绑定字段(该字段为行号)
      

  7.   

    如果没有统计行数的列,你可以在RowDataBound事件里赋CommandArgument一变量,row++吧,初始值为零,每触发一次该事件,也就是每读一行记录,该值就自增一,这样也可以提取出来