簡體   English   中英

在網格上顯示網格線

[英]Show Gridlines on a Grid

我正在使用Rad Grids,我使用內置皮膚來表現。 但是,我想為我的網格添加網格線。 網格線=“兩者”似乎不起作用。

 <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類,我將它設置在主表和網格本身上。 沒工作。

你的皮膚可能不支持網格線。 您可以嘗試使用其他皮膚來檢查或使用firebug。 如果皮膚不支持網格線,則需要使用自定義css / skin手動添加它們。

以下是RadGrid css類的說明: http//www.telerik.com/help/aspnet-ajax/grdcreatingnewskins.html

您可以嘗試自定義現有皮膚或使用以下內容:

.RadGrid_WebBlue .rgRow td
{
    border: solid 1px #000000;
}
protected void Page_Load(object sender, EventArgs e)
{
    this.GridView1.Attributes.Add("bordercolor", "c3cecc");
}

“使用GridView,聲明性bordercolor屬性添加內聯樣式聲明,該聲明僅適用於表本身,而不是單個單元格。

以編程方式添加bordercolor屬性不使用內聯樣式,而是使用HTML bordercolor屬性,這些屬性適用於表中的所有邊框。

這是Lee Dumond在我關於這個主題的博客文章中發表的評論:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM