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

How to set Column Header height?

12 Answers 933 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Pawz
Top achievements
Rank 1
Pawz asked on 29 Aug 2008, 06:48 AM
It's a pretty simple question - how do I set the height of my column headers? I've got a dataset that loads up with a 3-line header, but it gets cut off. I can't seem to find the right area to make the column header larger....

ie Column Header Text:

[3600 x
1200 x
3000  ] <------ This gets cut off
[ row  ]
[ row  ]
[ row  ]


12 Answers, 1 is accepted

Sort by
0
Martin Vasilev
Telerik team
answered on 29 Aug 2008, 04:20 PM
Hi Pawz,

Thank you for writing.

You can get or set the height of the column header row by using the code below:
(this.radGridView1.GridElement as GridTableElement).TableHeaderHeight = 100; 

You can also access the TableHeaderHeight property at design-time by using RadGrid's Smart Tag (click on the "Edit UI elements" and locate GridTableElement in the hierarchy).

If you have any other questions, please don't hesitate to ask us.
 

All the best,
Martin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Pawz
Top achievements
Rank 1
answered on 31 Aug 2008, 11:27 PM
Ok that works (thanks!) but there's one more thing - how would I get the text to wrap inside the table header?
0
Martin Vasilev
Telerik team
answered on 02 Sep 2008, 04:03 PM
Hello Pawz,

Thank you for writing.

Currently, RadGridView does not support wrapping text in its header cells. We will consider adding this functionality in some of the next releases.

Currently, you could manually split the header text to couple of rows. Please review the code-block below as reference:
 
void radGridView1_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e) 
    if (e.CellElement is GridHeaderCellElement && e.CellElement.ColumnIndex == 0) 
    { 
        e.CellElement.Text = "First line \nSecond Line"
    } 

If you need additional assistance, I will glad to help you again.
 

Greetings,
Martin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
KUMARAN
Top achievements
Rank 1
answered on 06 Jan 2015, 09:00 AM
How do I set the height of my column headers using Vb.net Coding..That above coding not working with my vb project.
0
Ralitsa
Telerik team
answered on 06 Jan 2015, 10:49 AM
Hi Kumaran,

Thank you for contacting us. 

If you want to change the height of header row, you can use the following code snippet: 
Me.RadGridView1.TableElement.TableHeaderHeight = 50

You can set the TextWrap property of column`s header cell using this code: 
Private Sub radGridView1_ViewCellFormatting(sender As Object, e As Telerik.WinControls.UI.CellFormattingEventArgs)
    If TypeOf e.CellElement Is GridHeaderCellElement AndAlso e.CellElement.ColumnIndex = 1 Then
        e.CellElement.TextWrap = True
    Else
        e.CellElement.ResetValue(LightVisualElement.TextWrapProperty, Telerik.WinControls.ValueResetFlags.Local)
    End If
End Sub

I attached a sample demo with version Q3 2014 SP1(2014.3.1202).  

Hope this will help you. Let me know if you have any another questions.

Regards,
Ralitsa
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
KUMARAN
Top achievements
Rank 1
answered on 06 Jan 2015, 11:50 AM
Thanks Ralitsa its working for Gridview,
but not working with my hierarchical grid 
I tried with Master template and Child templates .
Table element doesn't suit for the Master Template.


0
Ralitsa
Telerik team
answered on 07 Jan 2015, 08:42 AM
Hi Kumaran,

Thank you for your reply. 

You can use the following code snippet to set the height of a child template: 
Private Sub radGridView1_ViewCellFormatting(sender As Object, e As CellFormattingEventArgs)
    If TypeOf e.CellElement Is GridHeaderCellElement Then
        e.CellElement.TextWrap = True
    Else
        e.CellElement.ResetValue(LightVisualElement.TextWrapProperty, Telerik.WinControls.ValueResetFlags.Local)
    End If
    If TypeOf e.CellElement Is GridDetailViewCellElement Then
        Dim tableElement As GridTableElement = DirectCast(e.CellElement, GridDetailViewCellElement).ChildTableElement
        tableElement.TableHeaderHeight = 100
    End If
End Sub

In the attachments you can find a sample demo. 

Should you have further questions, I would be glad to help.
 
Regards,
Ralitsa
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Hugo Furth
Top achievements
Rank 1
answered on 08 Jan 2015, 05:03 PM
Trying to follow this but when I open the 'Edit UI' editor, all I see is the RootRadElement (attachement 1). GridTableElement is not in the hierarchy.

My grid is very simple....just 2 text columns (see attachement 2).

Any help appreciated.
Hugo
0
Ralitsa
Telerik team
answered on 12 Jan 2015, 08:48 AM
Hi Hugo,

Thank you for contacting us. 

You can not set the TableHeaderHeight property at design time. You need to set it at run time. Please use the following code snippet in the constructor of the form or in the Load event of form: 
this.radGridView1.TableElement.TableHeaderHeight = 50;

If you have any additional questions, please let me know.

Regards,
Ralitsa
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Curtis
Top achievements
Rank 1
Veteran
answered on 10 Jul 2018, 05:53 AM

Hi folks!

I have the same question as this original poster - but I'm several versions down the road and the posted solution(s) do not have any effect on my grid.

The code I'm trying is this:

gridMCs.TableElement.TableHeaderHeight = 50
gridMCs.TableElement.GroupHeaderHeight = 50

Clearly the name of the RadGridView is gridMCs and I'm setting the Column Header and Group Header to a height of 50...but these have no effect whatsoever which leads me to believe I have some OTHER property turned on that prevents these from being effective. 

 

Any suggestions would be terrific!

-Curtis

0
Curtis
Top achievements
Rank 1
Veteran
answered on 10 Jul 2018, 06:10 AM

Ok this is kind of strange but...on a whim I decided to try something:

I deleted the control from my form.  I added a new RadGridView and reset the Theme, added my columns and re-wired the events in my Form.  NOW the TableHeaderHeight AND GroupHeaderHeight both work.

 

I don't know what happened or why but I saved the original designer as well as the new one if you folks would like, please email me and i'll send you a .Zip of both files (It's proprietary information that my contract does not allow to be posted on a public board but I can share with the developer of the controls themselves.)

 

Sorry about my clearly unnecessary, previous post!

 

-Curtis

0
Hristo
Telerik team
answered on 11 Jul 2018, 01:02 PM
Hi Curtis,

We are not aware of an issue in the grid which could result in the initially described issue. I am glad that you have managed to resolve it. In case you experience it again please open up a support ticket and send us your project so that we can investigate it on our end.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GridView
Asked by
Pawz
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Pawz
Top achievements
Rank 1
KUMARAN
Top achievements
Rank 1
Ralitsa
Telerik team
Hugo Furth
Top achievements
Rank 1
Curtis
Top achievements
Rank 1
Veteran
Hristo
Telerik team
Share this question
or