keep selected row in grid view

Discussion in 'ASP .Net' started by Mike, Aug 10, 2007.

  1. Mike

    Mike Guest

    On my web form I have a gridview and I allow the user to edit a row but clicking a button above the grid. The Edit button takes them to a edit page with the details of the selected row. When they click 'save' on the Edit page it takes them back to the page.


    How can I have the row they selected to edited remain selected when they come back from the edit page?
     
    Mike, Aug 10, 2007
    #1
    1. Advertising

  2. Did you try setting GridView.SelectedIndex property after save?

    "Mike" wrote:

    > On my web form I have a gridview and I allow the user to edit a row but clicking a button above the grid. The Edit button takes them to a edit page with the details of the selected row. When they click 'save' on the Edit page it takes them back to the page.
    >
    >
    > How can I have the row they selected to edited remain selected when they come back from the edit page?
    >
    >
    >
    >
     
    =?Utf-8?B?U2l2YSBN?=, Aug 10, 2007
    #2
    1. Advertising

  3. Mike

    lee whitbeck Guest

    On Aug 10, 11:22 am, Siva M <> wrote:
    > Did you try setting GridView.SelectedIndex property after save?
    >
    > "Mike" wrote:
    > > On my web form I have a gridview and I allow the user to edit a row but clicking a button above the grid. The Edit button takes them to a edit page with the details of the selected row. When they click 'save' on the Edit page it takes them back to the page.

    >
    > > How can I have the row they selected to edited remain selected when they come back from the edit page?


    You will have to store the selected index, so that when they click
    save, and go back to the page you can reset the Index Value. You can
    use a session like below.

    GridView1.SelectedIndex = (Int32)Session["SelectedGridIndex"];
     
    lee whitbeck, Aug 10, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel Bass
    Replies:
    1
    Views:
    481
    Daniel Bass
    Jul 8, 2003
  2. Maheshkumar.R
    Replies:
    1
    Views:
    5,508
    Charlie@NISH
    Aug 12, 2005
  3. Luqman
    Replies:
    2
    Views:
    3,879
    Luqman
    Feb 1, 2006
  4. wahtnamas
    Replies:
    0
    Views:
    943
    wahtnamas
    May 1, 2009
  5. Jason
    Replies:
    1
    Views:
    2,416
    Alexey Smirnov
    Dec 14, 2009
Loading...

Share This Page