Asp.Net Gridview in Orchard CMS

Topics: Customizing Orchard
Oct 13, 2014 at 9:44 AM
How to implement asp.net gridview in Orchard CMS
Developer
Oct 13, 2014 at 10:30 PM
I think the ASP.NET GridView is a WebForms control.
Orchard is built with ASP.NET MVC, which doesn't support the WebForms framework.
Oct 14, 2014 at 6:57 AM
so can you please tell me how to display table like structure with sorting and custom pagination in Orchard?
Developer
Oct 14, 2014 at 7:13 AM
Sure, you could do the following:
  1. Create a custom controller + action in your module.
  2. Load your page of data.
  3. Create a Pager shape (look at the Blogs module for a good example).
  4. Return a view with a view model that contains your page of data as well as the pager shape.
  5. In your view, render an HTML table. Iterate over your page of data to render each <TR> element.
  6. To implement sorting, have your custom controller accept a column name argument on which to sort your data.
The following link provides a nice tutorial on how to do this in MVC: http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/sorting-filtering-and-paging-with-the-entity-framework-in-an-asp-net-mvc-application