Autosize specific columns?

1 Answer 94 Views
GridView
Willy
Top achievements
Rank 2
Iron
Iron
Willy asked on 11 Apr 2022, 10:15 PM

Hello, 

I am having difficulty auto sizing my columns. I want fill the whole grid view but have the the columns with the 3 abbreviations (BSA, GIS, ETC) to be small always. When set to  .AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill and .MasterTemplate.BestFitColumns() it is stretching out the WEB column. Is there a way to only allow the stretching to occur evenly on the first 4 columns but have the last 7 columns be small?  Thanks!

Dinko | Tech Support Engineer
Telerik team
commented on 14 Apr 2022, 11:44 AM

Hello Bill,

Setting the AutoSizeColumnsMode property to Fill will calculate equal sizes for each of the columns. They are expected to be set to such values that the available space in the grid table element is filled completely. Setting the Width property of the columns to give them fix size will prevent the auto-fill calculations when the grid's size is changed. 

The possible solution that I can suggest if you want to restrict width for some of the columns is to set the AutoSizeColumnsMode property to None and specify the width for each column according to your requirements. Thus, you can simulate the Fill behavior by adjusting the width only for those columns that you want to shrink/widen considering the total width of RadGridView. When the grid is resized, it is necessary to adjust the columns' width as well.

1 Answer, 1 is accepted

Sort by
0
lin
Top achievements
Rank 1
Iron
answered on 13 Apr 2022, 03:56 AM

good job! Can you help me?

Events that take place to avoid boredom correspond to cookie clicker

Tags
GridView
Asked by
Willy
Top achievements
Rank 2
Iron
Iron
Answers by
lin
Top achievements
Rank 1
Iron
Share this question
or