I’m new to MVC, and I’m having a hard time with a task that would be pretty easy with classic ASP.net.
I have a gridView that has a checkbox in each row, and I want a functionality where the user ticks the checkboxes of the rows he wants, clicks some button on the page and the selected rows would be sent to the server.
In normal ASP, the whole page is sent so its easy to check the gridView rows and the checkbox in each row, but in MVC the whole point is the Controller class not knowing about the details of the GUI, so how do I implement such a thing in MVC?
You don’t use server-side controls like that in MVC. GridView is for web forms framework. These two SO posts cover similar issues:
So there are a lot of examples in that post. I’ve used jQuery DataTables without issues. You build your table with a loop and then apply the DataTable to turn it into a searchable, sortable, filterable grid.
Walking through a tutorial, like the one at http://www.asp.net/mvc will get you familiar with how MVC works and show you how to update your models.
Update: I have no idea how your back-end is configured, so this is a shot-in-the-dark… but one easy way to get started is like this:
This will create a controller with all your CRUD operations and the related views. Poking around that should help… especially the
Edit.cshtml.