ASP.NET Web Pages - WebGrid సహాయక సాధన

WebGrid - ASP.NET Web సహాయక సాధనాలలో ఒకటి.

స్వయంగా HTML రాయడం

ముంది అధ్యాయాలలో, మేము డేటాబేస్ లోని డాటాను ప్రదర్శించడానికి razor కోడ్ ఉపయోగించి, అన్ని HTML టాగ్స్ ను స్వయంగా రాయడం చేశాము:

Database ఇన్స్టాన్స్

@{
var db = Database.Open("SmallBakery"); 
var selectQueryString = "SELECT * FROM Product ORDER BY Name"; 
}
<html> 
<body> 
<h1>Small Bakery Products</h1> 
<table> 
<tr>
<th>Id</th> 
<th>Product</th> 
<th>Description</th> 
<th>Price</th> 
</tr>
@foreach(var row in db.Query(selectQueryString))
{
<tr> 
<td>@row.Id</td> 
<td>@row.Name</td> 
<td>@row.Description</td> 
<td align="right">@row.Price</td> 
</tr> 
}
</table> 
</body> 
</html>

ఉదాహరణను నడుపుము

WebGrid సహాయకాన్ని ఉపయోగించడం

డేటాను ప్రదర్శించడానికి WebGrid సహాయకాన్ని ఉపయోగించడం సులభం

WebGrid సహాయకం:

  • డిస్ప్లే డేటా యొక్క HTML పట్టికను స్వయంచాలకంగా నిర్మిస్తుంది
  • వివిధ ఫార్మట్ ఆప్షన్స్ ను మద్దతు ఉంది
  • డేటా పేజీకరణను మద్దతు ఉంది
  • కులాంకరణ పేర్లను క్లిక్ చేయడం ద్వారా క్రమీకరించడానికి మద్దతు ఉంది

WebGrid ఉదాహరణ

@{ 
var db = Database.Open("SmallBakery") ; 
var selectQueryString = "SELECT * FROM Product ORDER BY Id"; 
var data = db.Query(selectQueryString); 
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>

ఉదాహరణను నడుపుము