We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Resizing column heights with GridControl

Hi,

I've got custom grid implementation using the GridControl based on the RepeaterUserControlSample code.

I want to improve it so that my user control which is used to edit row data can change it's height according to data that is entered.

Specifically, the user will make changes to the row data through the user control which will cause the user control to increase or descrease in height. I then was the grid row to resize accordingly.

What is the easiest way to do this? I've tried using RowHeights.ResizeToFit, but it doesn't seem to work in this situation (it's always resizes far too small).

Thanks in advance,

Ben.

4 Replies

RA Rajagopal Syncfusion Team August 2, 2007 03:53 PM UTC

Hi Ben,

If you want to autosize the rowheight as the user enters data inside the cell, then please try the below property settings that will help you in doing this.

this.gridControl1.TableStyle.WrapText = true;
this.gridControl1.TableStyle.AutoSize = true;

Let me know if you have any other questions.

Have a nice time.
Regards,
Rajagopal


BF Ben Fisher August 3, 2007 09:59 AM UTC

Hi,

The fix you suggests has no effect.

As I stated in the first post I have implemented a grid based on the RepeaterUserControlSample. This means I implement my own binding and use a custom user control to display and handle the editing of the data.

I want to be able to adjust the height of my custom user control and also the height of the row based on a particular user action.

I have tried calling RowHeights.SetSize(). This allows me to adjust the row height, but causes other problems.

If for example I have three rows. If I increase the height of the first row by 50% the height of the 3rd row decreases by 50%. It seems that although I can increase the row height of an individual row, the accumulated height of all the rows remains the same, so rows are effectively being pushed off (squahsed up against) the end of the grid.

Please could you suggest a fix for this.

I recommend looking at the sample I mentioned before replying again.

Thanks,

Ben.


>Hi Ben,

If you want to autosize the rowheight as the user enters data inside the cell, then please try the below property settings that will help you in doing this.

this.gridControl1.TableStyle.WrapText = true;
this.gridControl1.TableStyle.AutoSize = true;

Let me know if you have any other questions.

Have a nice time.
Regards,
Rajagopal


BF Ben Fisher August 3, 2007 02:23 PM UTC

Hi, i've now got a bit more information about the problem.

It seems that the problem may be with the scroll bars. They just don't seem to readjust to take into account the increase in row height.

That actual problem once I've changed the row height seems to simply be that I can not scroll any further than I could before changing the height.

This effectively means rows at the end of the grid cannot be reached.

Does anyone have any ideas as to how i can reset the scroll bars somehow


BF Ben Fisher August 3, 2007 02:38 PM UTC

Ah... I found it.

You can use GridControl.UpdateScrollBars to get the grid to recalculate how much scrolling the scrollbars will allow.


Loader.
Live Chat Icon For mobile
Up arrow icon