This is a migrated thread and some comments may be shown as answers.

Working with Back Button

3 Answers 72 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chad Johnson
Top achievements
Rank 1
Chad Johnson asked on 18 Mar 2009, 02:40 PM
Greetings,

I'm having a bit of a problem with a RadGrid.  I have a page used by Admins with a grid that has several fields, but has a specific field with IDs for users.  Above the grid, I have a RadToolbar, with 8 buttons.  One of the buttons will take the Admin to a profile page, where you can view/edit a user's info.  The problem is with this profile page, there is no way back to the page you were just on, so if you selected the wrong user or don't wish to edit their info, the only way back is to use the IE back button, or to renavigate your way back to the previous page.

The problem occurs when you try and use the IE back button.  The page will redisplay, with the RadGrid moving the selected row up to the first row.  That is fine, but the grid keeps the previous person's selected ID.

Ex.  You have 5 people in the grid.  You select number 4 and choose to edit their profile.  Upon the button firing, you go to the profile page, only to not wish to do anything to the user's info, so you click back, thus returning you to the previous page.  Now the first person in the grid is selected.  Instead of reselecting someone, you decide to edit number 1's profile.  Upon the button being clicked, you are taken to the profile page, but instead of number 1's info, you see number 4's.  It is as if the grid cannot comprehend that the person selected is different, and the Ids haven't changed.

My question is, is there a way to set the selected row to the person whose last ID was selected when the IE back button is pressed, or is there a way to just reset the ID to the first person when the grid is brought back using the IE back button?  Thank you.

Chad Johnson

3 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 23 Mar 2009, 03:07 PM
Hi Chad,

Could you please elaborate a bit more on your scenario? How exactly you pass thes IDs through pages? How do you initially select the first the grid item?

I would suggest you to check out the below samples on how you could use RadWindow to implement your scenario:

http://demos.telerik.com/aspnet-ajax/window/examples/usingurlforserverarguments/defaultcs.aspx
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=window

I hope this helps.

All the best,
Iana
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Chad Johnson
Top achievements
Rank 1
answered on 23 Mar 2009, 03:24 PM
The way I pass the ID is simply through a query string into the next page.

Ex.  I select a user in the grid.  On the toolbar, I click Edit Profile.  The code behind pulls the ID for that row and then redirects to the new URL like so: 
Response.Redirect("EditProfile.aspx?ProfileID=" +  
                                rgdMemberList.MasterTableView.DataKeyValues[Int32.Parse(rgdMemberList.SelectedIndexes[0])]["ID"].ToString()  
                                + "&Filter=" + CoPFilter); 

Also, the grid is set to select the first person when the page is first loaded.  Even when I turn that off, when I hit back from the Profile page, the first person is still selected.  Neither example really helped.  I'm physically moving to another page.  Thanks.

Chad Johnson
0
Iana Tsolova
Telerik team
answered on 26 Mar 2009, 08:54 AM
Hello Chad,

Thank you for the detailed explanation.
I hope this article can help you achieve your goal. Check it out and let me know if this works for you. 

Regards,
Iana
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Chad Johnson
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Chad Johnson
Top achievements
Rank 1
Share this question
or