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

Word Wrap in Grid Header

3 Answers 1519 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 2
Bob asked on 31 Dec 2015, 04:51 PM

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

3 Answers, 1 is accepted

Sort by
0
Accepted
Veena
Top achievements
Rank 1
answered on 31 Dec 2015, 09:34 PM

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

0
NPL IT
Top achievements
Rank 1
answered on 21 Jan 2020, 09:31 PM
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.
0
Petar
Telerik team
answered on 23 Jan 2020, 01:41 PM

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.
Tags
Grid
Asked by
Bob
Top achievements
Rank 2
Answers by
Veena
Top achievements
Rank 1
NPL IT
Top achievements
Rank 1
Petar
Telerik team
Share this question
or