This is a migrated thread and some comments may be shown as answers.

Header Font Size Ignored

3 Answers 302 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 23 Apr 2008, 05:53 PM
Hi,
I have a grid with 4 visible columns. The problem I'm having is that the header for the last column ignores the font-size property that I've set (12px). All the other headers displayed correctly.

Any reason why?

Thanks.


<rad:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True" 
        DataSourceID="dsSearch" ShowGroupPanel="True"  
        AllowCustomPaging="True" AutoGenerateColumns="False"  
        AllowMultiRowSelection="True"
        <HeaderStyle Font-Names="Verdana,Tahoma,Arial" Font-Size="12px" /> 
        <ClientSettings AllowDragToGroup="True"
            <Selecting AllowRowSelect="True" /> 
        </ClientSettings> 
        <MasterTableView DataSourceID="dsSearch"
            <RowIndicatorColumn Visible="False"
                <HeaderStyle Width="20px" /> 
            </RowIndicatorColumn> 
            <ExpandCollapseColumn Resizable="False" Visible="False"
                <HeaderStyle Width="20px" /> 
            </ExpandCollapseColumn> 
            <Columns> 
                <rad:GridBoundColumn DataField="ID" HeaderText="ID" UniqueName="colID"  
                    Visible="False"
                </rad:GridBoundColumn> 
                <rad:GridTemplateColumn UniqueName="colSelect"
                    <ItemTemplate> 
                        <asp:CheckBox ID="chkSelect" runat="server" /> 
                    </ItemTemplate> 
                </rad:GridTemplateColumn> 
                <rad:GridTemplateColumn HeaderText="Keywords" UniqueName="colKeywords"
                    <ItemTemplate> 
                        <asp:Label ID="Label12" runat="server" Text="Label"></asp:Label> 
                    </ItemTemplate> 
                    <ItemStyle Font-Names="Verdana,Tahoma,Arial" Font-Size="12px" /> 
                </rad:GridTemplateColumn> 
                <rad:GridHyperLinkColumn DataNavigateUrlField="ID"  
                    DataNavigateUrlFormatString="~/bookinfo.aspx?BookID={0}"  
                    DataTextField="Title" UniqueName="colTitle" HeaderText="Title"
                    <ItemStyle Font-Names="Verdana,Tahoma,Arial" Font-Size="12px" /> 
                </rad:GridHyperLinkColumn> 
                <rad:GridBoundColumn DataField="CategoryTitle" HeaderText="Dewey Category"  
                    UniqueName="colCategoryTitle"
                    <HeaderStyle Font-Names="Verdana,Tahoma,Arial" Font-Size="12px" /> 
                    <ItemStyle Font-Names="Verdana,Tahoma,Arial" Font-Size="12px" /> 
                </rad:GridBoundColumn> 
            </Columns> 
        </MasterTableView> 
    </rad:RadGrid> 

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Apr 2008, 06:08 AM
Hi Paul,

Try setting the font size for the header of a GridColumn in the code behind as shown below.

CS:
  protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridHeaderItem) 
        { 
            GridHeaderItem header = (GridHeaderItem)e.Item; 
            header["Name"].Font.Size = 12
        } 
    } 


Thanks
Shinu.
0
Paul
Top achievements
Rank 1
answered on 24 Apr 2008, 06:38 AM
Hi Shinu,

Your code works. How do I change the units of the fonts to px instead of pt.

Thanks
0
Travis Johnson
Top achievements
Rank 1
answered on 09 Feb 2011, 10:43 PM
unit.pixel(12)
Tags
Grid
Asked by
Paul
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Paul
Top achievements
Rank 1
Travis Johnson
Top achievements
Rank 1
Share this question
or