Info
Version: | 1.4.3 |
Author(s): | Ashish Shukla |
Last Update: | Friday, April 28, 2017 |
.NET Fiddle: | Create the first Fiddle |
Project Url: | http://www.codecompiled.com/grid-control-webapi/ |
NuGet Url: | https://www.nuget.org/packages/WebAPIDataGrid |
Install
Install-Package WebAPIDataGrid
dotnet add package WebAPIDataGrid
paket add WebAPIDataGrid
WebAPIDataGrid Download (Unzip the "nupkg" after downloading)
Dependencies
- jQuery(>= 1.8.0)
- System.Linq.Dynamic(>= 1.0.7)
Tags
The grid will display data for any entity.You just need to call the GetValues method on html table as:
$("tblEmployees").GetValues(({ URL: "/api/values1/",IdColumn: "RollNo"}); .URL is the URL of the REST service.IdColumn is the column that uniquely identifies an entity
To use the grid and display the data on a page
1.include the follwing js and css in the web page
script src="../Scripts/WebGrid.js" type="text/javascript"
link href="../Content/GridStyle.css" rel="stylesheet"
Grid control also uses jquery ,so also reference the jquery library on the page.
2.Declare html table on the page
3.Call the GetValues method on the declared table
$("IdOfTable").GetValues({
URL: "/api/ControllerName/",
IdColumn: "NameofPrimaryKeyColumn"
4.Add the following attribute to the Controller class
WebGrid.PagingAttribute(EntityId = "AnyIdentifier", PageSize = SizeOfPage, EntityType = typeof(TypeOfEntity)
5.Derive the controller class from the CustomController class.
You can also sort the displayed data by clicking the grid column headers.