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

HtmlViewDefinition Header Row Height

3 Answers 68 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 19 Feb 2016, 11:44 AM

Hi,

I have a HtmlViewDefinition that is added to a grid so as to provide detail information for a row, similar to your example in http://www.telerik.com/help/winforms/gridview-overview.html except I only have a single row defined in the HtmlViewDefinition

This works OK, but I need to enable column headers which I do by setting 

template.ShowColumnHeaders = True

and then for each column setting

template.Columns(column.FieldName).HeaderText

This seems to enable the headers OK and they are displayed but I have a problem with the header row height. It appears to consume the entire row height for the HtmlViewDefinition.RowTemplate.Row I have added and I can't find a way to modify it.

Is there a way to change the header row height?

Thanks,

Mark.

 

 

3 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 19 Feb 2016, 04:59 PM
Hi Mark,

Thank you for writing.

You can adjust the height of the rows part of you view definition by directly accessing it in the RowTemplate:
HtmlViewDefinition viewDef = new HtmlViewDefinition();
// ...
viewDef.RowTemplate.Rows[0].Height = 150;

My suggestion is that you leave it with its default size and let it arrange itself according to the defined cell definition. Then you can handle the RowForamtting event and change the height of the actual data row to a value of your choice: 
private void radGridView1_RowFormatting(object sender, RowFormattingEventArgs e)
{
    GridDataRowElement rowElement = e.RowElement as GridDataRowElement;
    if (rowElement !=  null && e.RowElement.RowInfo.HierarchyLevel == 1)
    {
        e.RowElement.RowInfo.Height = 250;
    }
}

I am also sending you a gif file showing the result on my end.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Mark
Top achievements
Rank 1
answered on 22 Feb 2016, 09:35 AM

Hi,

This has helped tremendously. The way I have actually managed to resolve this is in RowFormatting as suggested,

 

I've added :

If TypeOf e.RowElement Is GridTableHeaderRowElement Then CType(e.RowElement, GridTableHeaderRowElement).RowInfo.Height = 23

And this sets the header height correctly.

Many thanks for your help.

 

0
Hristo
Telerik team
answered on 22 Feb 2016, 01:32 PM
Hi Mark,

Thank you for writing back.

I am glad that I managed to help. Indeed, the addition you have made would specify explicitly the height of the header row.

Please let me know if I can assist you any further.

Regards,
Hristo Merdjanov
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Mark
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Mark
Top achievements
Rank 1
Share this question
or