ASP. NET Web Pages-WebGrid helper, pageswebgrid
WebGrid-one of the many useful ASP. NET Web help tools.
Compile your own HTML
In the previous section, we used the razor code to display the data in the database and wrote all HTML tags in person:
Database instance
@{var db = Database.Open("SmallBakery"); var selectQueryString = "SELECT * FROM Product ORDER BY Name"; }
Running instances
Use the WebGrid helper
It is easier to use the WebGrid help tool to display data.
WebGrid helper:
- Automatically create an HTML table for displaying data
- Supports different formatting options
- Data paging is supported.
- Supports sorting by clicking Column Titles
WebGrid instance
@{ var db = Database.Open("SmallBakery") ; var selectQueryString = "SELECT * FROM Product ORDER BY Id"; var data = db.Query(selectQueryString); var grid = new WebGrid(data); }
Running instances