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

[Solved] Autosizerows with minimum height

5 Answers 720 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Julien
Top achievements
Rank 1
Julien asked on 31 Jul 2009, 05:32 PM

Hi,
Is it possible to set the autosizerows = true with a minimum row height for each row of the datagrig without doing a loop on each row?

 Thanks

5 Answers, 1 is accepted

Sort by
0
Boryana
Telerik team
answered on 03 Aug 2009, 01:42 PM
Hi Julien,

Thank you for contacting us. Instead of iterating over all the rows, you can handle CreateRow event and set the MinHeight property of each row. Please, note that you should subscribe to this event before filling the TableAdapter.

 public Form1() 
        { 
            InitializeComponent(); 
            this.radGridView1.CreateRow += new Telerik.WinControls.UI.GridViewCreateRowEventHandler(radGridView1_CreateRow); 
        } 
 
        void radGridView1_CreateRow(object sender, Telerik.WinControls.UI.GridViewCreateRowEventArgs e) 
        { 
            e.RowInfo.MinHeight = 40; 
        } 

I hope this is helpful. If you have further questions, do not hesitate to contact me back.

All the best,
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
Dev J
Top achievements
Rank 1
answered on 08 Dec 2009, 01:58 PM
Why does this not work with Group rows? I'm doing this:

void radGridView1_CreateRow(object sender, Telerik.WinControls.UI.GridViewCreateRowEventArgs e)    
{    
    If TypeOf e.RowInfo Is GridViewGroupRowInfo Then 
        e.RowInfo.MinHeight = 50  
    Else 
        e.RowInfo.MinHeight = 40;    
    End If 

The other rows work fine and obey the MinHeight of 40, but the Group rows apparently ignore the MinHeight and still autosize much smaller than 50.

Thanks,
-DJ
0
Jack
Telerik team
answered on 09 Dec 2009, 09:31 AM
Hi Dev J,

RadGridView uses virtualization and creates visual row elements only for the rows that are currently visible on the screen. CreateRow event fires only when visual rows are created. Because of this, setting the MinHeight when handling CreateRow event is not correct. A better option is to iterate the Rows collection.

Group rows are not automatically sized and their size can't be changed by using the UI. You should set the GroupHeaderHeight property instead:

Me.RadGridView1.GridElement.GroupHeaderHeight = 50

I hope this helps. Should you have any further questions, please write back.

All the best,

Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Dev J
Top achievements
Rank 1
answered on 09 Dec 2009, 03:16 PM
Hey Jack,

Thanks for the reply. Unfortunately, I tried your suggestion and nothing changes. You did catch the fact that I have AutoSizeRows = True?

-DJ
0
Jack
Telerik team
answered on 10 Dec 2009, 10:25 AM
Hi Dev J,

I tested the solution with our latest release - Q3 2009 SP1. Now I noticed that you are using an old version of RadControls for WinForms. You have to update your version so that group row height can be customized. I will be glad to assist you if something pops out when switching to the new version.

Sincerely yours,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Julien
Top achievements
Rank 1
Answers by
Boryana
Telerik team
Dev J
Top achievements
Rank 1
Jack
Telerik team
Share this question
or