Asp.Net Razor中通过WebGrid显示数据库数据
@{ var db = Database.Open("SmallBakery") ; var query = "SELECT * FROM Product ORDER BY Id"; var data = db.Query(query); var grid = new WebGrid(data); } <html> <head> <title>Displaying Data Using the WebGrid Helper</title> </head> <body> <h1>Small Bakery Products</h1> <div id="grid"> @grid.GetHtml() </div> </body> </html>