asp.net - 设置gridview标题颜色

标签 asp.net gridview

我在 asp.net 和 c# 中工作
我有一个网格 View 。我在该网格 View 中有 10 列。我对网格 View 标题文本颜色有一些问题。
一些列标题有链接(用于排序)。此类标题文本的颜色为浅蓝色。单击蓝色后将更改为另一种颜色。

某些列标题没有链接。此类标题文本的颜色为灰色。

我想让整个标题文本的颜色变成灰色等单一颜色。单击链接后,它必须是相同的颜色。
提前致谢

最佳答案

您可以在 css 文件中定义 css 类。定义类后,您可以使用类名设置网格 CssClass 属性。例如;

.GridStyle
{
    border: 6px solid rgb(217, 231, 255);
    background-color: White;
    font-family: arial;
    font-size: 12px;
    border-collapse: collapse;
    margin-bottom: 0px;
}
.GridStyle tr
{
    border: 1px solid rgb(217, 231, 255);
    color: Black;
    height: 25px;
}
/* Your grid header column style */
.GridStyle th
{
    background-color: rgb(217, 231, 255);
    border: none;
    text-align: left;
    font-weight: bold;
    font-size: 15px;
    padding: 4px;
    color:Black;
}
/* Your grid header link style */
.GridStyle tr th a,.GridStyle tr th a:visited
{
        color:Black;
}
.GridStyle tr th, .GridStyle tr td table tr td
{
    border: none;
}

.GridStyle td
{
    border-bottom: 1px solid rgb(217, 231, 255);
    padding: 2px;
}

关于asp.net - 设置gridview标题颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3921497/

相关文章:

c# - ASP.NET 加密 - aspnet_regiis - 农场

c# - AsP.Net MVC 5 如何在 View 中调用函数

c# - 我应该在 SQL 中还是在 LINQ 中执行 Where 子句?

asp.net - 带有服务总线的 SignalR Azure 云服务

android - Android 中具有 View 回收功能的可扩展 GridView

html - Gridview 标题格式

c# - 如何访问 onRowDataBound 事件

javascript - 如何将 GridView 中控件的 id 传递给 Jquery?

jquery - HTML5如何绑定(bind)本地数据库到asp gridview

c# - 带有自定义 ItemTemplate 的 ASP.Net 动态 Gridview