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

Set row height of grid on server side after databind

3 Answers 99 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Thomas Salt
Top achievements
Rank 1
Thomas Salt asked on 17 Mar 2010, 02:24 PM
I have two grids which have the same amount of rows, but the heights of the rows are not the same.  Is it possible to loop through both tables and set the row height in each table to the same amount?  The first table is going to have a dynamic row height, and I would like the second table to have the same row heights as the first table.  Is this possible?

Thanks!

3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 22 Mar 2010, 01:18 PM
Hello Thomas,

You can set the height of any item in the grid control, as shown in the following snippet:

protected void Button1_Click(object sender, EventArgs e)
{
RadGrid1.MasterTableView.Items[1].Height = Unit.Pixel(100);
}

This can also be done in the PreRender event handler of the control, after checking the available contents of the item.
I hope this information helps.

Greetings,
Yavor
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
Thomas Salt
Top achievements
Rank 1
answered on 22 Mar 2010, 03:58 PM
Thanks for the response.  Your code works as expected, but the problem arises when I need to get the height of the rows from the first grid.  I'm not explicitly setting the heights of the rows because I would like them to shrink and grow as needed.  When I try and access the height properties of Grid1 they are set to an empty string.  What I would need is Grid1 to be bound with data, and then after it's bound loop through each row and grab the dynamically set height the rad grid has given to it.  Once I grab the row height of Grid1 I would then want to set the corresponding row in Grid2 to the same height.  Is this possible?

Thank you!
0
Yavor
Telerik team
answered on 24 Mar 2010, 01:09 PM
Hello Thomas,

When no height is explicitly set to the element, it will be rendered in the browser occupying as much height as needed, determined by its contents, and any other related properties, such as css classes/paddings/margins. Thus, the only other alternative would be to access these element(s) of the grid on the client, and check their height. This is demonstrated in the screenshot attached to this message.
I hope this helps.

Greetings,
Yavor
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.
Tags
Grid
Asked by
Thomas Salt
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Thomas Salt
Top achievements
Rank 1
Share this question
or