954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Creating running totals in a gridview footer? using razor syntax webmatrix

i need to have Total of price displayed in webgrid. from the code below.

@{
var db = Database.Open("SmallBakery") ;
var selectQueryString = "SELECT * FROM Product ORDER BY Id";
var data = db.Query(selectQueryString);
var grid = new WebGrid(source: data,
defaultSort: "Name", rowPerPage: 3);
}
<!DOCTYPE html>
<html>
<head>
<title>Displaying Data Using the WebGrid Helper (Custom Formatting)</title>
<style type="text/css">
.product { width: 200px; font-weight:bold;}
</style>
</head>
<body>
<h1>Small Bakery Products</h1>
<div id="grid">
@grid.GetHtml(
columns: grid.Columns(
grid.Column("Name", "Product", style: "product"),
grid.Column("Description", format:@<i>@item.Description</i>),
grid.Column("Price", format:@<text>$@item.Price</text>)
)
)
</div>
</body>
</html>
Ajuddy
Newbie Poster
15 posts since Jun 2007
Reputation Points: 10
Solved Threads: 0
 

use LINQ to get what you want

mani-hellboy
Junior Poster in Training
69 posts since Feb 2012
Reputation Points: 0
Solved Threads: 7
 

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: