This project is read-only.

Posting Model List back to the controller

Oct 17, 2016 at 1:58 PM
Edited Oct 17, 2016 at 2:36 PM

Scenario (Using MVC 4 with bootstrap, VS2012) ~

In Index() controller method I default a time range of 1 hour of data for my model along with start and end datetimes.
The View has 2 DateTimePickers, users can then use these to reselect other periods.
If this happens I reload the view \ grid then with the new periods of logs based on a post to a different method in the

This is prob a silly question but ~

When I use any of the filters or sortable options, the grid seems to call my Index() method in the controller with the model as null.
This then resets my time period to 1 hour loading the original data.

Is there a way to avoid this happening? i.e. when filtering \ sorting can I get to keep the list used for my grid within the model?

Oct 25, 2016 at 11:36 AM
In answer to my own question here, I just ended up forgoing the filtering \ sorting and paging options. I have seperate search controls on my page that I use to define the search results which post back, binding to the model, reloading the grid each time.

Retrospectively it seems like this grid is of most use when you can read the entire datasource up front and do not have to perform additional db draws. My application is a mix of things so I can potentially use it with filters etc in other pages.
Aug 3, 2017 at 11:54 PM
Edited Aug 3, 2017 at 11:55 PM
This will put an action link in your grid and call the controller/action with the params you specify

columns.Add().SetWidth(75).Sortable(true).Encoded(false).Sanitized(false).RenderValueAs(model => @Html.ActionLink("Details", "ParkingDetails", new { sDisplayname = model.DisplayName, dtBirthDate = model.BirthDate })).Titled("");