Parse WebGrid - Very useful ASP.NET web helper

零下一度
Release: 2017-05-25 09:42:34
Original
2284 people have browsed it

WebGrid - One of many useful ASP.NET web helpers.

Written HTML

In the previous chapter, you used Razor code to display database data. All HTML tags were handwritten:

Database Example

@{ var db = Database.Open("SmallBakery"); var selectQueryString = "SELECT * FROM Product ORDER BY Name"; }   

Small Bakery Products

@foreach(var row in db.Query(selectQueryString)) { }
Id Product Description Price
@row.Id @row.Name @row.Description @row.Price
Copy after login

Using the WebGrid Helper

The WebGrid Helper provides an easier way to display data.

WebGrid Helper:

Automatically create an HTML table to display data

Support different formatting options

Support data paging display

Support sorting by clicking on the list title

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); }   Displaying Data Using the WebGrid Helper 
  

Small Bakery Products

@grid.GetHtml()
Copy after login

[Related recommendations]

1.ASP.NET Free Video Tutorial

2.Share ASP.NET study notes (8) WebPages Helper

3.Share ASP.NET study notes (7) WebPages object detailed explanation

4.Detailed introduction to ASP.NET MVC--View

5.A brief definition and introduction to ASP.NET

The above is the detailed content of Parse WebGrid - Very useful ASP.NET web helper. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!