如何更改gridview字体?

发布于 2024-09-16 04:33:57 字数 1433 浏览 1 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

揽清风入怀 2024-09-23 04:33:57

您可以使用每个 BoundField 上的 ItemStyle-Font-Names 属性来更改网格中项目的字体,并且可以使用 HeaderStyle-Font-Names 属性来更改网格中项目的字体。更改标题。

如果您想使用 css,请继续阅读...

您还可以使用 HeaderStyle-CssClass="gridview-header",然后您可以定义一个 css 类来进行样式设置:

.gridview-header
{
    font-weight: bold;
    font-size: 10px;
    padding-bottom: 3px;
    color:  #666666;
    padding-top: 3px;
    font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
    background-color: #EEEEEE;
}

您可以定义整个 gridview 的 css 类,通过设置 gridview 的 CssClass 属性:

CssClass="gridview"

然后,您可以设置 tr 属性(tr 是 gridview 为行呈现的内容)并在 css 文件中设置字体:

.gridview tr
{
    /* set font properties here */
}

在项目中使用 css 时,您通常有一个 css 文件(例如,将其称为 StyleSheet.css)。然后,在您的 aspx 页面(或视图,如果您使用 MVC)中,您可以包含这样的样式表,假设 StyleSheet.css 位于名为 Styles 的文件夹中站点根文件夹:

<head id="Head1" runat="server">
    <link href="Styles/StyleSheet.css" rel="stylesheet" type="text/css" />
</head>

You can use the ItemStyle-Font-Names property on each BoundField to change the font of the items in the grid, and you can use the HeaderStyle-Font-Names property to change the headers.

If you want to use css, read on...

You can also use a HeaderStyle-CssClass="gridview-header", then you could define a css class to do the styling:

.gridview-header
{
    font-weight: bold;
    font-size: 10px;
    padding-bottom: 3px;
    color:  #666666;
    padding-top: 3px;
    font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
    background-color: #EEEEEE;
}

And you could define a css class for the entire gridview, by setting the gridview's CssClass property:

CssClass="gridview"

Then, you can set the tr property (the tr is what the gridview renders for rows) and set the font there in your css file:

.gridview tr
{
    /* set font properties here */
}

When using css in a project, you usually have a css file (call it StyleSheet.css, for example). Then in your aspx pages (or views if you're using MVC), you can include the stylesheet like this, assuming the StyleSheet.css is in a folder called Styles in the site root folder:

<head id="Head1" runat="server">
    <link href="Styles/StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文