Word Wrap in Grid Header

4 posts, 1 answers
  1. Bob
    Bob avatar
    29 posts
    Member since:
    Dec 2014

    Posted 31 Dec 2015 Link to this post

    Is there a way to wrap the Header text in the MVC grid?

     I have tried putting a "\n" (new line) and a CHR(13) (carriage return) in the Title attribute and they don't work. Am i missing something or is it just not possible?

     

    TIA

    Bob Mathis

  2. Answer
    Veena
    Veena avatar
    14 posts
    Member since:
    Oct 2015

    Posted 31 Dec 2015 Link to this post

    Hi Bob,

    If you want to wrap all the headers for all the grid you can try something like this 

    .k-grid-header .k-header {
        overflow: visible !important;
        white-space: normal !important;
    }

    If you want to wrap for just one column, you can try this 

    columns.Bound(p => p.LongHeaderName).Title("LongHeaderName").HeaderHtmlAttributes(new { style = "overflow: visible; white-space: normal" });

     

    Thanks,

    Veena

  3. NPL IT
    NPL IT  avatar
    4 posts
    Member since:
    Aug 2015

    Posted 21 Jan 2020 in reply to Veena Link to this post

    Hi can you tell me where to paste this code, in a MVC grid layout I'd assumed it would be placed somewhere in the view but can't get it to work.  Thanks.
  4. Petar
    Admin
    Petar avatar
    502 posts

    Posted 23 Jan 2020 Link to this post

    Hi Shawn,

    As the last post in this thread is from 2015, the provided solution may not be applicable for the 2020 version of UI for ASP.NET MVC. 

    If I have to answer your question directly, this code:

    .k-grid-header .k-header {
        overflow: visible !important;
        white-space: normal !important;
    }

    Should be put in style tags on the page. 

    As mentioned above I assume that the above code won't resolve the issue you have but I am not sure what is the exact functionality you want to achieve.

    If you give me more details about the targeted functionality I will give feedback/solution that is applicable for the latest version of the UI for ASP.NET MVC suite. 

    Regards,
    Petar
    Progress Telerik

    Get quickly onboarded and successful with your Telerik UI for ASP.NET MVC with the dedicated Virtual Classroom technical training, available to all active customers.
Back to Top