You can set the format of values in a WebGrid using the format optional argument of the column constructor.
You could try something like this, where the color of Invoices is red if value > 50 or blue if not
<html lang="en">
<head>
<style>
.column1 {color: red; font-weight: bold;}
.column2 {color: blue;}
</style>
</head>
<body>
<p>@stot1.GetHtml(
columns:stot1.Columns(
stot1.Column(
columnName:"Invoices",
format:@<text>
<span class=@(item.Invoices > 50 ? "column1" : "column2")>
@item.Invoices.ToString("C")
</span>
</text>
)
)
)</p>
</body>
</html>
but I see no reason to use WebGrids in your situation.
The WebGrid helper renders data from a database with support for paging and sorting, but your query returns only one value and you don't need either of them.
Edited
A better solution is to query the table with the QueryValue method, which returns a single scalar value, and display the value without the WebGrid.
In the following an example for the only Invoice
@{
var db = Database.Open("YourTable");
var itot = db.QueryValue("SELECT SUM(Subtotal) AS Invoices FROM Salesord_hdr where Orderdate = 41190 and Invoicecount >= 1");
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
<style>
.column1 {color: red; font-weight: bold;}
.column2 {color: blue;}
</style>
</head>
<body>
<p>Invoices:
<span class=@(itot > 50 ? "column1" : "column2")>@itot.ToString("C")</span>
</p>
</body>
</html>
@qtotl.GetHtml() @stotl.GetHtml()
– Bevan Oct 11 '12 at 01:35