Click here to Skip to main content
14,865,310 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to change MVC WebGrid Cell text color when CarID is greater than 8
Here is my Code:
@{

var grid = new WebGrid(ViewBag.WebGrid, canPage: true, rowsPerPage: 5, ajaxUpdateContainerId:"d");
grid.Pager(WebGridPagerModes.NextPrevious);
}

@grid.GetHtml(
tableStyle: "table",
alternatingRowStyle: "alternate",
selectedRowStyle: "selected",
headerStyle: "header",
columns: grid.Columns(
grid.Column("CarID",
format: @<text>@(item.CarID > 8 ? @item.Carid:@item.Carid)

),
grid.Column("Brand",
format: @<text>
@item.Brand
),
grid.Column("Brand",
format: @<text>
@item.Brand
),
grid.Column("Action",canSort:false,
format: (item) => Html.ActionLink("Edit", "Edit1", new { id = item.CarID }))
));

Posted
Comments
Kailash Urmliya 8-Mar-17 5:40am
   
how to add dynamic footer according to database column in mvc webgrid

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900