Click here to Skip to main content
13,043,865 members (46,427 online)
Rate this:
 
Please Sign up or sign in to vote.
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 17-Feb-13 9:05am
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 17 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100