ASP .Net 中的透明 GridView?

发布于 2024-12-21 04:18:51 字数 317 浏览 6 评论 0原文

我想知道是否有任何方法可以使 GridView 透明。 我知道边框可以设为透明,并且我知道如何做到这一点,

GridView Screenshot

但区域 1图像中的 2单元格背景标题 是我关心的问题。 我更喜欢保留原始背景图像,所以我更喜欢透明度。但如果不行的话 我想我也可以接受添加背景图像。

提前致谢。

I wonder if is there any way to make a GridView transparent.
I know that the borders can be made transparent and i know how to do it,

GridView Screenshot

but the area 1 and 2 in the image, backgrounds of the cells and titles are my concern.
i prefer to keep my original background image so i prefer transparency. But if it's a no go
i can accept to add a background image too i guess.

Thanx in advance.

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

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

发布评论

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

评论(2

蓝海 2024-12-28 04:18:51

看起来您正在使用 GridView 的内置样式。例如,您的 gridview 可能看起来像这样:

<asp:GridView runat="server" ID="GridView1" BackColor="#DEBA84" BorderColor="#DEBA84" 
    BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2">
    <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
    <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
    <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
    <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
    <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
    <SortedAscendingCellStyle BackColor="#FFF1D4" />
    <SortedAscendingHeaderStyle BackColor="#B95C30" />
    <SortedDescendingCellStyle BackColor="#F1E5CE" />
    <SortedDescendingHeaderStyle BackColor="#93451F" />
</asp:GridView>

如果是这种情况,只需删除所有样式,如下所示:

<asp:GridView runat="server" ID="GridView1">
</asp:GridView>

或者,您可以使用 CSS 和 !important 属性覆盖 Gridview 的内联样式,如下所示(您需要相应地更新 CSS):

<style type="text/css">
    table {background:transparent !important;}
    table tr {background:transparent !important;}
</style>

It looks like you're using the built in styles of a GridView. For example, your gridview might look something like:

<asp:GridView runat="server" ID="GridView1" BackColor="#DEBA84" BorderColor="#DEBA84" 
    BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2">
    <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
    <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
    <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
    <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
    <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
    <SortedAscendingCellStyle BackColor="#FFF1D4" />
    <SortedAscendingHeaderStyle BackColor="#B95C30" />
    <SortedDescendingCellStyle BackColor="#F1E5CE" />
    <SortedDescendingHeaderStyle BackColor="#93451F" />
</asp:GridView>

If that is the case, just remove all of your styles like so:

<asp:GridView runat="server" ID="GridView1">
</asp:GridView>

Alternatively, you can override the inline styles of the Gridview using CSS and the !important property like so (you'll need to update the CSS accordingly):

<style type="text/css">
    table {background:transparent !important;}
    table tr {background:transparent !important;}
</style>
燕归巢 2024-12-28 04:18:51

创建一个透明的小图像。
然后使用css将其添加到表中:

    table
    {
        background-image: Transparent5by5.gif;
    }

Create a small image that is transparent.
Then use css to add it to the table:

    table
    {
        background-image: Transparent5by5.gif;
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文