Click here to Skip to main content
12,690,575 members (32,269 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET
In my Web Form I have three drop down column , one label, one add button and a gridview .
On my gridview I have a hyperlink column.
On clicking that hyperlink column I have to redirected to next web form with value of that row’s all 4 above said column on 4 label's .
How this will be implement in c#
Please Help.
Posted 23-Nov-12 1:09am
ChandraShekar.SK 23-Nov-12 6:19am
Try if this works..
Session["Value1"] = gridView.Rows[e.RowIndex].Cells[1].Text;

and retrieve the value on the other page like.
String value1 = Session["Value1"].ToString();
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

refer the following code

<asp:GridView ID="grvTest" runat="server" AutoGenerateColumns="false"
        <asp:BoundField DataField="Name" HeaderText="Name" />
                <asp:LinkButton ID="lnkTest" runat="server" Text="Move"       CommandName="Move"></asp:LinkButton>

protected void grvTest_RowCommand(object sender, GridViewCommandEventArgs e)
          if (e.CommandName == "Move")
           GridViewRow row=(GridViewRow)((LinkButton)e.CommandSource).NamingContainer;
           string name = row.Cells[0].Text;
           Response.Redirect("Page2.aspx?name=" + name);

collect all grid cell values and form the url as given above
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Here's an example for you to pass the value to other webform through query string

<asp:TemplateField HeaderText="Document ID" HeaderStyle-CssClass="gridheaderleft"
                                        ItemStyle-CssClass="boundfield" HeaderStyle-Width="100px">
                                            <asp:HyperLink ID="hyperDocketDetails" Text='<%# bind("ClientDocumentIdentifier") %>'
                                                runat="server" NavigateUrl='<%# "DocumentDetails.aspx?id="+ DataBinder.Eval(Container.DataItem,"ID") +"&moduleid="+ Request["moduleid"] + "&retURL=" + HttpUtility.UrlEncode(Request.Path + "?" + Request.QueryString) %>' />
                                            <asp:Label ID="lblDocket" Text='<%# bind("ClientDocumentIdentifier") %>' runat="server" />

Hope it helps
Rate this: bad
Please Sign up or sign in to vote.

Solution 3


First of all try to locate GridViewRow(Track which row is clicked using LinkButton).

Then find all the desired control using GridView.Rows[index].FindControl("ControlID").

Cast control into appropriate tyle like "DropDown","Label" etc...

then using Response.Redirect(url), you can redirect as per your requirement.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170117.1 | Last Updated 23 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100