Multi Line Header

11 posts, 0 answers
  1. Orit
    Orit avatar
    97 posts
    Member since:
    Jun 2009

    Posted 08 Jun 2009 Link to this post

    Is there a way to set the header to be multi line
    when the text is long
    Thanks.
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 08 Jun 2009 Link to this post

    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.
  3. Calvin
    Calvin avatar
    42 posts
    Member since:
    Jul 2011

    Posted 12 Jul 2011 Link to this post

    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
  4. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 13 Jul 2011 Link to this post

    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!

  5. Calvin
    Calvin avatar
    42 posts
    Member since:
    Jul 2011

    Posted 13 Jul 2011 Link to this post

    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.
  6. Pete
    Pete avatar
    7 posts
    Member since:
    Feb 2013

    Posted 15 Feb 2013 Link to this post

    Fyi - the referenced link was not found, but can I get further details on using multi-line radgrid column headers?
  7. Yoan
    Admin
    Yoan avatar
    1182 posts

    Posted 15 Feb 2013 Link to this post

    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.

  8. Pete
    Pete avatar
    7 posts
    Member since:
    Feb 2013

    Posted 15 Feb 2013 Link to this post

    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.
  9. Yoan
    Admin
    Yoan avatar
    1182 posts

    Posted 19 Feb 2013 Link to this post

    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.

  10. Pete
    Pete avatar
    7 posts
    Member since:
    Feb 2013

    Posted 19 Feb 2013 Link to this post

    Thanks Yoan, but I'm using a telerik radgrid and there is no <telerik:GridBoundColumn.Header> element.

    Am I missing something?
  11. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 19 Feb 2013 Link to this post

    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.

Back to Top