Grid.MVC: Easy to Implement Grid Using MVC

This blog demonstrates the utilization Grid.MVC for executing grids. Grid.MVC includes functionalities for controls like arranging, separating, paging and some more. This gives a simple approach to actualize HTML tables containing every one of the information. This Grid.MVC would require a model that would be an IEnumerable type or accumulation of information. Here I have utilized hardcoded esteems for populating the matrix. Presently a days numerous network sources are accessible, mostly Telerik Kendo Grid has picked up the market, however utilizing this for little applications would be simple and light since we needn't bother with any outsider instrument as we can specifically introduce Grid.MVC from the Nuget bundle that I will be appearing underneath.

Presently its opportunity to include/introduce the Grid.MVC to our venture. In the conext of MVC we would rather say add the Grid.MVC reference to the project. Therefore for that we can see Reference in the project structure skimming in the course of the web extend. We at that point right-tap on that, at that point select Manage Nuget bundle, at that point we straightforwardly scan online for the Grid.MVC, we discover the package reference with an introduce catch alongside. click on that for the installation of the package.

Presently it's a great opportunity to include the Grid code hinder into our view. The MVC Grid is utilized:

@using GridMvc.Html
@Html.Grid(Model).Columns(columns =>columns.Add(c=>c.ID))

The functionalities like Sortable() acknowledge a boolean esteem WithPaging() the esteem parameter that proposes the quantity of records in the framework and the Titled() is utilized to include the title of the separate section. You can likewise observe the reference for the StyleSheets(.css) and Scripts(.js) for the grid.mvc and bootstrap as well. At last when we run the application utilizing the URL : "/product/Index" and we get the accompanying outcome:

@Html.Grid(Model).Columns(columns =>
{
columns.Add(c => c.MeasureId).Titled("ID");
columns.Add(c => c.Measure).Titled("Measure").Filterable(true);
columns.Add(c => c.MeasuresCode).Titled("Measures Code");
columns.Add().Encoded(false).Sanitized(false).SetWidth(10).Titled("").RenderValueAs(c => @Html.ActionLink("Edit", "editMeasure", "Measure", null, null, null, new { @id = @c.MeasureId, @name = @c.MeasureName }, null));
columns.Add().Encoded(false).Sanitized(false).SetWidth(10).Titled("").RenderValueAs(c => @Html.ActionLink("Delete", "DeleteMeasure", "Measure", null, null, null, new { @id = @c.MeasureId}, null));
}).WithPaging(5).Sortable(true)

Webb Architect is an experienced software development company for MVC architecture ,AJax, Web development, Web Applications, PHP & Asp.net.

Join hands with us, to chose us as an extension of your business, not just an agency.

work with us ›

Join hands with us, to chose us as an extension of your business, not just an agency.

work with us ›

Get A Free Quote: