how can i pass the value from the gridview to the next webform? here is my gridview code below:

<asp:TemplateField HeaderText="">
                <ItemTemplate>
                    <asp:LinkButton ID ="lnkEdit" runat="server" Text="View" PostBackUrl='<%# "Details.aspx?RowIndex=" + Container.DataItemIndex %>'></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>

but i cant seem to make it work. it goes to the next form but does not get the value. my id has a format "1000001" and it does read it.

here is my code for the next page. i created a new gridview just to store the value from.

 int rowIndex = int.Parse(Request.QueryString["RowIndex"]);
            GridView gv1 = (GridView)this.Page.PreviousPage.FindControl("GridView1");
            GridViewRow row = GridView1.Rows[rowIndex];
            lblID.Text = row.Cells[0].Text;

Related posts

Recent Viewed