求助大家,GridView里面编辑项,怎么传到另外个页面进行修改,就是想得到当前项索引,跳转到另外个页面进行编辑,但是接收不到该值,不知道哪里出错了
编辑是个图片按钮
            ImageButton edit = e.Row.FindControl("edit") as ImageButton;
            edit.Attributes.Add("onclick", "edit_url(" + e.Row.Cells[0].Text + ");");这句不管用接收编辑页面为
edit_SyUser.aspx  string cindex = Request.QueryString["CIndex"].ToString();
            this.useId.Text = cindex;
            SqlParameter[] pars ={User1.ParamBuilder("@CIndex", Convert.ToInt32(cindex), SqlDbType.Char)};
            DataSet ds=User1.renturnDb("single_user",pars);            this.txt_name.Text = ds.Tables[0].Rows[0][1].ToString();
            this.txt_userPwd.Text = ds.Tables[0].Rows[0][2].ToString();
            this.ddl_department.SelectedValue = ds.Tables[0].Rows[0][3].ToString();
            this.ddl_role.SelectedValue = ds.Tables[0].Rows[0][4].ToString();
            this.txt_addTime.Text=ds.Tables[0].Rows[0][5].ToString();GridView

解决方案 »

  1.   

     edit.Attributes.Add("onclick", "edit_url(" + e.Row.Cells[0].Text + ");");
    这是像前台注册javascript脚本
      

  2.   

    有得了怎么复杂吗?
    <a href="你的修改页.aspx?id=<%# Eval("id")%>">修改</a>
      

  3.   

    edit.Attributes.Add("onclick", "edit_url(\"" + e.Row.Cells[0].Text + "\")"); 这样试一下,或者你获取一下e.Row.Cells[0].Text 的值,是不是想要的 楼上的方法可以参考
      

  4.   

    是这样的,在gridview里面使用eval的话,添加一个模板列
      <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"  OnRowDataBound="GridView1_RowDataBound" >
                    <Columns>
                        <asp:BoundField HeaderText="ID" DataField="ID" />
                           <asp:TemplateField HeaderText="编辑">
                            <ItemTemplate><a href="你的修改页.aspx?id=<%# Eval("id")%>">修改</a>
                            </ItemTemplate>
                        </asp:TemplateField>                </Columns>