I have five pages in my application created in ASP.Net MVC 4.0 using .aspx engine. I have to use Kendo Grid in all the five pages. But I want to avoid duplicating the Kendo Grid code in five pages. Because in future there may be 10-15 pages or more will be added. So that time instead of duplicating the code, needs to create a generic Kendo Grid template. ie, I should create only one partial class, but the below details will be changing for five different pages.
- Generic Grid should be able to bind to different models. ie, Model change in all five pages ( Ex: ProductModel, SalesModel, InvoiceModel etc )
- Number of columns will differ for each model ( Ex: ProductModel (5 columns), SalesModel (4 Columns), InvoiceModel (3 Columns))
- In each page, Some of the columns are sortable and some are not sortable. I should be able to specify.
- When Click on Edit and Delete buttons I should populate different dialog boxes based on page and I should pass different parameters ( Ex: When Click on Edit button of ProductModel, ProductCode should pass as parameter and that Edit product dialog should display, similarly for other pages)
- In each page, when user click on paging and sorting buttons there are search parameters which should be maintained and pass those parameters ( Ex: Search parameters will also vary for each page. In Read function of Grid I should be able to pass different number and type of parameters for different pages.
- The edit and delete function names will be different for different pages. (Ex: Product Page will have edit function name as EditProduct, similary for other page EditInvoice etc )
By considering the above requirements, Is it possible to create a Generic Kendo Grid. If so can you please help with different techniques / guide / sample code snippet / project.
Thanks.