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

Multi Line Header

10 Answers 1111 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Orit
Top achievements
Rank 1
Orit asked on 08 Jun 2009, 09:48 AM
Is there a way to set the header to be multi line
when the text is long
Thanks.

10 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 08 Jun 2009, 10:48 AM
Hello Orit,

Please check this project for more info:
http://www.telerik.com/ClientsFiles/133336_217627-multi-line-column-header.zip

Kind regards,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Calvin
Top achievements
Rank 2
answered on 12 Jul 2011, 11:28 PM
Does your example still exist?  The link returns a 404.

This works:

<telerik:GridViewDataColumn.Header>
    <TextBlock TextAlignment="Center" Padding="0 3">
        <TextBlock.Inlines>
            <Run>Component</Run>
            <LineBreak />
            <Run>Hub</Run>
            <LineBreak />
            <Run>Assembly</Run>
        </TextBlock.Inlines>
    </TextBlock>
</telerik:GridViewDataColumn.Header>


But it's not very elegant.  I suspect there's a better way.
Thanks
0
Milan
Telerik team
answered on 13 Jul 2011, 06:56 AM
Hi Calvin,

Could you please take a look at this blog post and let me know if that is what you are looking for.

Kind regards,
Milan
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Calvin
Top achievements
Rank 2
answered on 13 Jul 2011, 04:30 PM
Thanks, I'm glad to learn about the merged column headers (placed in a row above the un-merged column headers).  I'll certainly use that functionality.

But what I'm actually looking for is a better way to handle the following scenario:

transform this
A very long multiple word column header
short item 1
short item 2
short item 3

into this
A very long
multiple word
column header

short item 1
short item 2
short item 3

And do this in a way that preserves the automatic column sizing capability.  The technique I mentioned in the previous post works; but it's a bit of a hassle to declare the column headers.
0
Pete
Top achievements
Rank 1
answered on 15 Feb 2013, 04:32 PM
Fyi - the referenced link was not found, but can I get further details on using multi-line radgrid column headers?
0
Yoan
Telerik team
answered on 15 Feb 2013, 04:37 PM
Hello Pete,

I can suggest you to check this help article where you can find information about merged GridViewColumn's headers.

All the best,
Yoan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Pete
Top achievements
Rank 1
answered on 15 Feb 2013, 05:11 PM
I've used this code, but still no wrapping.  The header text is Compartment Number.

 

 

protected void CompartmentsGrid_PreRender(object sender, EventArgs e)

 

{

 

 

GridHeaderItem header = (GridHeaderItem)CompartmentsGrid.MasterTableView.GetItems(GridItemType.Header)[0];

 

header[

 

"Number"].Wrap = true;

 

header[

 

"Number"].Width = Unit.Pixel(100);

 

}


Thanks for any help.
0
Yoan
Telerik team
answered on 19 Feb 2013, 08:41 AM
Hello Pete,


You can define GridViewDataColumn's header like so:
<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}">
                   <telerik:GridViewDataColumn.Header>
                       <TextBlock Text="this is very very very very very very very very very long text " Width="100" TextWrapping="Wrap"/>
                   </telerik:GridViewDataColumn.Header>
               </telerik:GridViewDataColumn>

I have prepared a sample project that shows you the approach. Please find it attached.

Kind regards,
Yoan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Pete
Top achievements
Rank 1
answered on 19 Feb 2013, 04:02 PM
Thanks Yoan, but I'm using a telerik radgrid and there is no <telerik:GridBoundColumn.Header> element.

Am I missing something?
0
Vlad
Telerik team
answered on 19 Feb 2013, 04:06 PM
Hi,

It seems that your are using the grid for ASP.NET. Please post your question in the relevant forum category!

Greetings,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Orit
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Calvin
Top achievements
Rank 2
Milan
Telerik team
Pete
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or