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

Setting a custom height for the header row

2 Answers 1166 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Rahul
Top achievements
Rank 1
Rahul asked on 14 Jul 2012, 08:11 PM
Please take a look at the attached image.

As you can see I have vertical columns but I'm facing 2 problems.

1) The bigger issue is that for a lot of the columns, it cuts off the name and displays ... Even for the 1st one to show up the way it did, I for some reason had to expand the WIDTH of the Allocated To column. However all columns after the Reviewed column are dynamic and vary based on the database this is run against. See the image marked 2. I had to expand the last column to get the height to increase more and finally had to make it even wider for all the text to be readable. However I can't afford to make these columns that wide. Like I said they are dynamic and will hold at most 2 digits. I have searched your forums and tried the following but it does absolutely nothing. I have tried different numbers as well without luck.

rgv.TableElement.TableHeaderHeight = 200;

God knows why something that should be soooo simple is made so needlessly complex. I can't expand the height of the row by pulling down also on the row (or through code) but can increase it by increasing the column width. Who came up with this logic?

2) Would it be possible to have some columns show up horizontally and some vertically? This is not such a big deal...it would be a nice to have feature.

Issue #1 is more important so any help on that will be appreciated. 

2 Answers, 1 is accepted

Sort by
0
Accepted
Jack
Telerik team
answered on 18 Jul 2012, 10:01 AM
Hello Rahul,

Directly to your questions:

1. You cannot use the TableHeaderHeight when using RadGridView in AutoSizeRows mode. In this scenario the row height is calculated automatically. Instead, you should set the MinHeight property. Consider the sample below:
this.radGridView1.MasterView.TableHeaderRow.MinHeight = 50;
this.radGridView1.AutoSizeRows = true;

2. Yes, you can change the text orientation only for some specific cells. Here is a sample:
void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
    GridHeaderCellElement cell = e.CellElement as GridHeaderCellElement;
    if (cell != null && cell.ColumnInfo.Name == "Value")
    {
        cell.TextOrientation = Orientation.Vertical;
    }
}

I hope this helps.
 
Regards,
Jack
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Rahul
Top achievements
Rank 1
answered on 19 Jul 2012, 09:15 AM
Thanks, Jack. Your solution worked like a charm.
Tags
GridView
Asked by
Rahul
Top achievements
Rank 1
Answers by
Jack
Telerik team
Rahul
Top achievements
Rank 1
Share this question
or