我在 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/