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

2 lines of text in the column header

16 Answers 2744 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Frank
Top achievements
Rank 1
Frank asked on 06 Sep 2007, 07:02 PM
I would like to display two line of text in my header colums ... how can this be done ?

16 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 07 Sep 2007, 12:31 PM
Hello Frank,

To set multi-line text in the header, you can use the following code:

radGridView1.MasterGridViewTemplate.Columns["myColumn"].HeaderText = "first line \n Second line \n third line";

You must also set the correct header row height trough GridTableElement.TableHeaderHeight property:

((GridTableElement)this.radGridView1.GridElement).TableHeaderHeight  = 50;

You can do this through the Properties in the design view as well.

 
All the best,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Larry
Top achievements
Rank 2
answered on 12 Jun 2009, 07:15 AM
Does this code still work for the current version of RadGrid for WinForms?  Also, what would be the code used for VB?
0
Boryana
Telerik team
answered on 12 Jun 2009, 10:46 AM
Hi Larry,

Thank you for your question. Please, consider the following code snippet:

 
 
   Me.radGridView1.MasterGridViewTemplate.Columns("myColumn").HeaderText = "first line " & vbLf & " second line " & vbLf & " third line" 
   Me.radGridView1.AutoSizeRows = True 
 
 

You can change the header text of an existing column; in the above example, I change the text of the column with the name "myColumn". Further, you can separate the lines of the header text using \n. In the current version of RadGridView, you do not have to set manually the height of the header row. All you need is to set is the AutoSizeRows property to true. Thus, the height of all rows will be automatically calculated depending on the content of the cells in the row.

I hope this helps. If you have further questions, do not hesitate to contact us back.

Regards,
Boryana
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
manoj sagoi
Top achievements
Rank 1
answered on 11 Feb 2010, 07:00 AM
i am using \n in header its working fine in grid coloumn but when i am exporting grid data to excel ,header is scattering wherever i used \n help pls
thx in advance
0
Martin Vasilev
Telerik team
answered on 16 Feb 2010, 01:15 PM
Hello manoj sagoi,

Thank you for writing. Currently, ExportToExcelML does not support multiline header text. We will include this feature in some of the next releases. Let me know if you have any other questions.

Regards,
Martin Vasilev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
zhyrox
Top achievements
Rank 1
answered on 09 Aug 2011, 03:45 PM
It does not work, I get the text with the symbol "\ n" and does not recognize the instruction MasterGridViewTemplate helps.

Ciro Zamudio Adame
0
Martin Vasilev
Telerik team
answered on 11 Aug 2011, 02:39 PM
Hi Ciro Zamudio Adame,

I have tested the settings proposed in this tread and they work as expected. Could you please share with us your exact code and which version of RadControls for Winforms you are using?

All the best,
Martin Vasilev
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Sivakumar
Top achievements
Rank 1
answered on 30 Sep 2013, 02:41 PM
Hi,

I have installed the Q2 2013 release of Rad controls for WPF. I want to have to 2 rows for a single record in the rad grid view. The thing is I am using Prism framework with MEF. Is it possible to do the same in the xaml itself instead of code behind code ? If so could you please share code for this ?
0
Stefan
Telerik team
answered on 01 Oct 2013, 11:47 AM
Hello Sivakumar,

This forum concerns RadControls for WinForms, while your question seems to be related to RadControls for WPF. Please address it to the appropriate forums in order to get correct answer: http://www.telerik.com/community/forums/wpf/gridview.aspx.
 
Regards,
Stefan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Anna
Top achievements
Rank 1
answered on 10 May 2017, 09:30 AM

http://stackoverflow.com/a/38203733/5256574

This is a helpful answer.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 12 May 2017, 09:44 AM
Hello Anna, 

Thank you for writing.  

The referred StackOverflow thread is relevant for the Kendo UI grid. However, this forum is related to the Telerik UI for WinForms suite. Feel free to use the appropriate forum for discussing different topics: http://www.telerik.com/forums

Thank you for your understanding.

Regards,
Dess
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
vinutha
Top achievements
Rank 1
answered on 04 Dec 2017, 10:23 AM

{field: "recordedInvestment", title: "Recorded<br>Investment",filterable: {cell: { inputWidth: gridWidth*0.06 ,type:"number",showOperators: false, operator: "eq"} },format: "{0:$ #,##.##}",minResizableWidth:gridWidth*0.06 }

 

 

while defining the column headers use <br> tag where u want it in next line. it worked for me.

0
Zim
Top achievements
Rank 1
answered on 18 Sep 2018, 08:00 AM
With Excel, we can enter a column name, and create a line break with the Alt-Enter key combination. How can we get the same effect (one or more lines in the column names) with Smartsheet?
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 18 Sep 2018, 08:41 AM
Hello, Zim,  

I would like to note that this forum is related to the Telerik UI for WinForms suite. However, it seems that you are using Smartsheet which is not connected to our suite. Could you please confirm the product that you are currently using?

Regards,
Dess
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
nate
Top achievements
Rank 1
answered on 28 Nov 2018, 11:09 PM
Select the cells that you would like to apply a Wrapped Text format to;
From the Format menu select Cells and then click the Alignment tab;
Put a check mark in the Wrap Text option and click OK.
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 29 Nov 2018, 09:02 AM
Hello, Nate,    

The described solution is not applicable for the RadGridView in the Telerik UI for WinForms suite which is the specified product for this forum thread.

In order to wrap the text in the cells, it is suitable to subscribe to the RadGridView.ViewCellFormatting event and set the CellElement.TextWrap property to true

private void radGridView1_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
{
    e.CellElement.TextWrap = true;
}

I hope this information helps.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Frank
Top achievements
Rank 1
Answers by
Jack
Telerik team
Larry
Top achievements
Rank 2
Boryana
Telerik team
manoj sagoi
Top achievements
Rank 1
Martin Vasilev
Telerik team
zhyrox
Top achievements
Rank 1
Sivakumar
Top achievements
Rank 1
Stefan
Telerik team
Anna
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
vinutha
Top achievements
Rank 1
Zim
Top achievements
Rank 1
nate
Top achievements
Rank 1
Share this question
or