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

[Solved] Word wrap in header not working

3 Answers 450 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Philip
Top achievements
Rank 1
Philip asked on 13 May 2008, 12:48 PM
Is there something special I need to do to get word-wrapping to work for the text in the column headers? I've tried everything thing I can think of but I can't get the text to wrap.
  • I've tried setting the wrap property to true on the HeaderStyle (and any other style I could find).  
  • I've tried settting Wrap property to True in code in the ItemDataBound event for the GridHeaderItem
  •  I've tried setting the TableLayout to Fixed and Auto (Fixed clips, Auto fits them all in one line)
<telerik:RadGrid  ID="grdSummaryData" runat="server" OnItemDataBound="grdSummaryData_ItemDataBound" 
                 Width="100%" BorderColor="Transparent" GridLines="None" Skin="" OnColumnCreated="grdSummaryData_ColumnCreated"
                <MasterTableView CommandItemDisplay="None" CurrentResetPageIndexAction="SetPageIndexToFirst" 
                    Dir="LTR" Frame="Border" GroupsDefaultExpanded="False" AutoGenerateColumns="False" TableLayout="Fixed"
                    <GroupByExpressions> 
                        <telerik:GridGroupByExpression> 
                            <SelectFields> 
                                <telerik:GridGroupByField FieldName="OrganizationName" HeaderText="Organization" FieldAlias="OrganizationName" FormatString="" />                                                             
                                <telerik:GridGroupByField FieldName="Total" HeaderText="Total" Aggregate="Sum" FieldAlias="Total" FormatString=""/> 
                                <telerik:GridGroupByField FieldName="NotStarted" HeaderText="Not Started" Aggregate="Sum" FieldAlias="NotStarted" FormatString=""/> 
                                <telerik:GridGroupByField FieldName="Unapproved" HeaderText="Unapproved" Aggregate="Sum" FieldAlias="Unapproved" FormatString=""/> 
                                <telerik:GridGroupByField FieldName="AwaitingApproval" HeaderText="Awaiting Approval" Aggregate="Sum" FieldAlias="AwaitingApproval" FormatString=""/> 
                                <telerik:GridGroupByField FieldName="Approved" HeaderText="Approved" Aggregate="Sum" FieldAlias="Approved" FormatString=""/> 
                            </SelectFields> 
                            <GroupByFields> 
                                <telerik:GridGroupByField FieldName="OrganizationName" FieldAlias="OrganizationName" FormatString="" HeaderText="" /> 
                            </GroupByFields> 
                        </telerik:GridGroupByExpression> 
                    </GroupByExpressions> 
                    <RowIndicatorColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" 
                        Visible="False"
                        <HeaderStyle Width="20px" /> 
                    </RowIndicatorColumn> 
                    <ExpandCollapseColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" 
                        Resizable="False" Visible="False"
                        <HeaderStyle Width="20px" /> 
                    </ExpandCollapseColumn> 
                    <EditFormSettings> 
                        <EditColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType"
                        </EditColumn> 
                    </EditFormSettings> 
                    <AlternatingItemStyle HorizontalAlign="Center" BackColor="#efefef" /> 
                    <HeaderStyle wrap="true" CssClass="header_Background" Font-Size="small" HorizontalAlign="Center"/> 
                    <ItemStyle HorizontalAlign="Center" /> 
                 
                    <Columns> 
                        <telerik:GridBoundColumn HeaderStyle-Width="40%" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" DataField="OrganizationName1" HeaderText="Organization" CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" ForceExtractValue="None" UniqueName="OrganizationName1"/> 
                        <telerik:GridBoundColumn HeaderStyle-Width="10%" DataField="Total" HeaderText="Total" CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" ForceExtractValue="None" UniqueName="Total"/> 
                        <telerik:GridBoundColumn HeaderStyle-Width="10%" DataField="NotStarted" HeaderText="Not Started" CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" ForceExtractValue="None" UniqueName="NotStarted"/> 
                        <telerik:GridBoundColumn HeaderStyle-Width="10%" DataField="Unapproved" HeaderText="Unapproved" CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" ForceExtractValue="None" UniqueName="Unapproved" /> 
                        <telerik:GridBoundColumn HeaderStyle-Width="10%" DataField="AwaitingApproval" HeaderText="Awaiting Approval" CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" ForceExtractValue="None" UniqueName="AwaitingApproval" /> 
                        <telerik:GridBoundColumn HeaderStyle-Width="10%" DataField="Approved" HeaderText="Approved" CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" ForceExtractValue="None" UniqueName="Approved" /> 
                        <telerik:GridBoundColumn HeaderStyle-Width="10%" DataFormatString="{0:G2}%" DataField="PercentApproved" HeaderText="Percent Approved" CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" ForceExtractValue="None" UniqueName="PercentApproved" /> 
                    </Columns> 
                </MasterTableView> 
                <ExportSettings> 
                    <Pdf FontType="Subset" PaperSize="Letter" /> 
                    <Excel Format="Html" /> 
                    <Csv ColumnDelimiter="Comma" RowDelimiter="NewLine" /> 
                </ExportSettings> 
            </telerik:RadGrid> 

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 13 May 2008, 01:12 PM
Hi Philip,

Try setting the Wrap property in the HeaderStyle tag for each column as shown below.

ASPX:
<telerik:GridBoundColumn DataField="ProductName"   HeaderText="ProductName" SortExpression="ProductName" 
                            UniqueName="ProductName">  
                            <HeaderStyle Wrap="true"  /> 
                        </telerik:GridBoundColumn> 
                        


Thanks
Princy.
0
Philip
Top achievements
Rank 1
answered on 13 May 2008, 01:25 PM
Thanks for the suggestion.

Unfortunately the headers are still not wrapping for me.
0
Philip
Top achievements
Rank 1
answered on 13 May 2008, 01:53 PM
I was able to get it to work by changing the HeaderStyle Width for each grid column from a % to a value. (10% - 50)
Tags
Grid
Asked by
Philip
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Philip
Top achievements
Rank 1
Share this question
or