下面是我的代码,它位于 View 层中,我正在努力更改,将列标题的颜色更改为橙色。请帮忙。
@model IEnumerable<uYilo_FMS.Models.vehicle_obj>
@using GridMvc.Html
@{
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="with=device-width"/>
<link href="@Url.Content("~/Content/Gridmvc.css")" rel="stylesheet" />
<script src="@Url.Content("~/Scripts/jquery-1.10.2.min.js")"></script>
<script src="@Url.Content("~/Scripts/gridmvc.min.js")"></script>
<rowDefinition Height="57" width="873">
<title>@ViewBag.Title = "Title"</title>
</head>
<body>
<h3>Vehicles List</h3>
<div class="page-wrap">
@Html.Grid(Model, GridRenderOptions.Create("VehiclesGrid")).Columns(columns =>
{
columns.Add().Encoded(false).Sanitized(false).RenderValueAs(c => @<img class="thumbnail" src="~/Content/images/@c.ImagePath" height="80" width="80" alt="@c.ImagePath" />);
columns.Add(c => c.displayName).Titled("Vehicle Name");
columns.Add(c => c.make).Titled("Make");
columns.Add(c => c.type).Titled("Type");
columns.Add(c => c.odometer).Titled("Odometer");
}).WithPaging(5).Sortable(true).
</div>
<script>
function getRow(vehicle_reg) {
$.jax({
url: '@Url.Action("DisplayTripHistory", "Home")',
data: JSON.stringify(vehicle_reg),
contentType: 'application/json',
dataType: 'json',
type: 'POST',
success: function () {
alert('SUCCESS');
},
error: function () {
alert('error');
}
}
);
}
</script>
最佳答案
渲染网格后你会看到网格使用的标题
.grid-header
类, 所以你可以创建 CSS 来改变它
例子:
.grid-header a{
color:red; }
您会看到文本标题颜色为红色
要了解更多信息,请查看此链接 http://www.codeproject.com/Tips/597253/Using-the-Grid-MVC-in-ASP-NET-MVC
希望对您有所帮助!
关于c# - 如何在 GridMvc 中设置列文本颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33208981/