在网格上显示网格线

发布于 2024-08-24 19:57:08 字数 2750 浏览 4 评论 0 原文

我正在使用 Rad Grids,并使用内置的 Skins 进行外观。但是,我想为我的网格添加网格线。 Gridlines =“两者”似乎不起作用。

 <telerik:RadGrid ID="RadGridProviders" Width="100%" GridLines="Both" AllowPaging="true" Skin="WebBlue" runat="server"  DataSourceID="SDSProvider" AutoGenerateColumns="false">
                    <MasterTableView DataSourceID="SDSProvider" PageSize="7" CellPadding="0" GridLines="Both" CellSpacing="0" DataKeyNames="ID,Entry_Loc" AllowMultiColumnSorting="True" AutoGenerateColumns="false"  >
                     <PagerStyle Mode="NextPrevNumericAndAdvanced"/>
                     <Columns>
                        <telerik:GridBoundColumn HeaderText="Organization Name" HeaderStyle-HorizontalAlign="Center" DataField="OrgName" SortExpression="OrgName">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Provider Type" HeaderStyle-HorizontalAlign="Center" DataField="TypeofProvider" SortExpression="TypeofProvider">
                        </telerik:GridBoundColumn>
                         <telerik:GridBoundColumn HeaderText="Contact Name" HeaderStyle-HorizontalAlign="Center" DataField="Contact" SortExpression="Contact">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Address" HeaderStyle-HorizontalAlign="Center" DataField="Address" SortExpression="Address">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Contact Number" HeaderStyle-HorizontalAlign="Center" DataField="Phone" SortExpression="Phone">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Creator Location" Visible="false" HeaderStyle-HorizontalAlign="Center" DataField="Entry_Loc" SortExpression="Entry_Loc">
                        </telerik:GridBoundColumn>
                        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" HeaderText="Delete Provider" HeaderStyle-HorizontalAlign="Center" 
                            ConfirmText="Are You Sure You Want to Delete this Provider?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete Provider Confirmation"
                            UniqueName="DeleteProv">
                        </telerik:GridButtonColumn> 
                     </Columns>
                    </MasterTableView>
                    </telerik:RadGrid>

我刚刚尝试添加自定义 CSS

.mytable tr td
    {
                border: solid 1px #000000;
    }

我为 masterr 表内的项目样式设置了 css 类,我将其设置在主表和网格本身上。没用。

I'm using Rad Grids and I use the built in Skins for appearance. However, I 'd like to add Gridlines for my Grid. Gridlines = "Both" does not seem to work.

 <telerik:RadGrid ID="RadGridProviders" Width="100%" GridLines="Both" AllowPaging="true" Skin="WebBlue" runat="server"  DataSourceID="SDSProvider" AutoGenerateColumns="false">
                    <MasterTableView DataSourceID="SDSProvider" PageSize="7" CellPadding="0" GridLines="Both" CellSpacing="0" DataKeyNames="ID,Entry_Loc" AllowMultiColumnSorting="True" AutoGenerateColumns="false"  >
                     <PagerStyle Mode="NextPrevNumericAndAdvanced"/>
                     <Columns>
                        <telerik:GridBoundColumn HeaderText="Organization Name" HeaderStyle-HorizontalAlign="Center" DataField="OrgName" SortExpression="OrgName">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Provider Type" HeaderStyle-HorizontalAlign="Center" DataField="TypeofProvider" SortExpression="TypeofProvider">
                        </telerik:GridBoundColumn>
                         <telerik:GridBoundColumn HeaderText="Contact Name" HeaderStyle-HorizontalAlign="Center" DataField="Contact" SortExpression="Contact">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Address" HeaderStyle-HorizontalAlign="Center" DataField="Address" SortExpression="Address">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Contact Number" HeaderStyle-HorizontalAlign="Center" DataField="Phone" SortExpression="Phone">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Creator Location" Visible="false" HeaderStyle-HorizontalAlign="Center" DataField="Entry_Loc" SortExpression="Entry_Loc">
                        </telerik:GridBoundColumn>
                        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" HeaderText="Delete Provider" HeaderStyle-HorizontalAlign="Center" 
                            ConfirmText="Are You Sure You Want to Delete this Provider?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete Provider Confirmation"
                            UniqueName="DeleteProv">
                        </telerik:GridButtonColumn> 
                     </Columns>
                    </MasterTableView>
                    </telerik:RadGrid>

I just tried adding custom CSS

.mytable tr td
    {
                border: solid 1px #000000;
    }

I set the css class for the item style inside of the masterr table, i set it on the master table and on the grid itself. Didn't work.

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

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

发布评论

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

评论(2

旧竹 2024-08-31 19:57:08

您的皮肤可能不支持网格线。您可以尝试使用其他皮肤来检查这一点或使用 firebug。如果皮肤不支持网格线,您将需要使用自定义 css/skin 手动添加它们。

以下是 RadGrid css 类的描述:
http://www.telerik.com/help/aspnet-ajax/grdcreatingnewskins。 html

您可以尝试自定义现有皮肤或使用类似以下内容的内容:

.RadGrid_WebBlue .rgRow td
{
    border: solid 1px #000000;
}

Your skin may not support grid lines. You can try using another skin to check this or use firebug. If skin does not support grid lines you will need to add them manually with custom css/skin.

Here is description of RadGrid css classes:
http://www.telerik.com/help/aspnet-ajax/grdcreatingnewskins.html

You can try customizing existing skin or use something like:

.RadGrid_WebBlue .rgRow td
{
    border: solid 1px #000000;
}
杯别 2024-08-31 19:57:08
protected void Page_Load(object sender, EventArgs e)
{
    this.GridView1.Attributes.Add("bordercolor", "c3cecc");
}

“对于 GridView,声明性 bordercolor 属性添加了一个内联样式声明,该声明仅适用于表格本身,而不适用

于单个单元格。以编程方式添加 bordercolor 属性不使用内联样式,而是使用 HTML bordercolor 属性,浏览器将其应用于 ALL表格内的边框。”

这是 Lee Dumond 在我关于此主题的博客文章中发表的评论:

http://codersbarn.com/post/2009/05/31/Set-Color-of-GridLines-in-Gridview.aspx

protected void Page_Load(object sender, EventArgs e)
{
    this.GridView1.Attributes.Add("bordercolor", "c3cecc");
}

"With the GridView, the declarative bordercolor attribute adds an inline style declaration which only applies to the table itself, not individual cells.

Adding the bordercolor attribute programmatically does not use an inline style, but uses the HTML bordercolor property, which browsers apply to ALL borders inside the table."

This was a comment made by Lee Dumond on my blog post on this topic:

http://codersbarn.com/post/2009/05/31/Set-Color-of-GridLines-in-Gridview.aspx

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