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

Making Datasource requests after leaving grid view

0 Answers 36 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Jim
Top achievements
Rank 1
Jim asked on 27 Feb 2015, 03:51 AM
Using grid in MVC 5 app in a razor view.  The grid will generate a list of items resulting from the datasource request query i have setup.

When user clicks on custom button on a row, it sends message to my controller to edit that row.  The controller then does its business and shows a new razor view which is the edit view for my row's record.  this all works as expected.

What i want to be able to do is this:

once in the Edit view, i want next and prev buttons that will move to the next record - in the list of records that was determined by the results of the previous gridview.  So if gridview is showing 5 rows for record ID's :  2,4,6,8,10, when i click on edit for row 4, it takes me to the edit screen, and the NEXT button will take me to record ID 6, and prev would take me to RecordID 2.

What i have figured out is that i can have a custom command send the current datasource's set of records back to the controller.  this works fine....found that on this post:   http://www.telerik.com/forums/passing-current-datasourcerequest-to-a-custom-command

what i thought i could do is send the datasource request back down to the edit view along with the list of id's in a hidden control.  when user hits prev/next the ids list could be parsed.  If the user hit next and we were at the last item in hidden list, then i could program a request to the database for the next page of items from the datasource and parse those results to know the next set of 5 records to use for prev/next.

getting stuck here - can't seem to pass around the datasource request between controllers and new views easily.

is this idea possible or is there a better way?

No answers yet. Maybe you can help?

Tags
Data Source
Asked by
Jim
Top achievements
Rank 1
Share this question
or