Pass Value of the hyperlinked field in a GridView to the textbox on the other page RRS feed

  • Question

  • User1288822499 posted

    Hi All,

    How can we fech a hyperlinked grid view data into a text box on the other page?

    I am trying some thing like this but couldn't get it working

     Page lastPage = (Page)Context.Handler;

    GridView1 is on the other webPage.

    Friday, April 11, 2014 5:03 PM


  • User1918509225 posted


    About your problem,please try the solution below:

    1 Add a Row Commnand event to the GridView ,just like below:

    <asp:GridView onRowCommand="GvRowCommand" ID="GridView1" runat="server">
                       <asp:LinkButton Text="Click" ID="LinkButton2" runat="server" 
                           CommandArgument='<%# Eval("SomeId") %>'/>                                                                                 </ItemTemplate>                                                            

    2  In the server side:

    protected void GvRowCommand(object sender, GridViewCommandEventArgs e)
          var someId= e.CommandArgument;

    3 In the target page,you can try to use QueryString in page_load like below,set the value to textbox:


    Hope it can help you.

    Best Regards,

    Kevin Shen.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, April 13, 2014 10:47 PM