如何在GridMvc中设置列文本颜色

本文关键字:文本 颜色 设置 GridMvc | 更新日期: 2023-09-27 18:18:21

这是我的代码下面,它是在视图层我正在努力改变改变我的列标题的颜色为橙色。请帮助。

@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>

如何在GridMvc中设置列文本颜色

渲染网格后,您将看到网格的标题使用

.grid-header

类,所以你可以创建CSS来改变

的例子:

.grid-header a{
color:red; }

您将看到文本标题颜色为红色

要了解更多,请点击此链接http://www.codeproject.com/Tips/597253/Using-the-Grid-MVC-in-ASP-NET-MVC

希望有帮助!