日期:2014-05-17  浏览次数:20376 次

求助大家,GridView里面编辑项,怎么传到另外个页面进行修改
求助大家,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

------解决方案--------------------
引用:
引用:有得了怎么复杂吗?
<a href="你的修改页.aspx?id=<%# Eval("id")%>">修改</a>
正解... 一个修改而已  弄那么写脚本没必要的
是这样的,在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>