This is a migrated thread and some comments may be shown as answers.
Gridview columns resize
7 Answers 328 Views
This is a migrated thread and some comments may be shown as answers.
Kristof
Top achievements
Rank 1
Kristof asked on 12 Jul 2007, 09:03 AM
Hi,

when I set the columns in a gridview to autosize, initialy everything looks fine. But when the form and thus the grid is resized, the most right columns starts growing and will eventually be the only visible column.
This also applies when the grid is not resized but redrawn. It seems there's something wrong with the calcualtion of the column widths. Is this a known issue?

7 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 12 Jul 2007, 12:36 PM
Hello Kristof,

Thank you for reporting this.

Yes, this is a well known issue and it is already fixed in the latest Q1 2007 SP2 release of our controls.

If you find any other issues, please do not hesitate to write us.

All the best,
Georgi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
fgalarraga
Top achievements
Rank 1
answered on 12 Aug 2007, 02:00 AM
I've just installed SP2 and I am having the same issue.  Was this fixed in Q1 2007 SP2?  My referenced DLL are as follows:

Telerik.WinControls.GridView
Runtime Version: v2.0.50727
Version: 3.5.0.0

Thank you,
Frank
0
Georgi
Telerik team
answered on 13 Aug 2007, 02:27 PM
Hello fgalarraga,

Sorry for the inconvenience, but we cannot reproduce this problem with the SP2 release. Will it be possible to send us your test project? It is possible that we are missing something, so we would like to check your exact case. Thanks in advance.

 
Regards,
Georgi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
fgalarraga
Top achievements
Rank 1
answered on 20 Aug 2007, 05:06 PM
Found a work around but is this the best solution?

Thank you,
Frank

'Resize column width for best fit
For Each gvC As Telerik.WinControls.UI.GridViewColumn In gvResults.Columns
      gvC.BestFit()
Next
0
Jack
Telerik team
answered on 21 Aug 2007, 01:23 PM
Hello fgalarraga,

Yes, this workaround will do the job for the moment. With Q2 2007 there will be no need of using it and you may mark it as a temporary fix.
 

Best wishes,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
jtby
Top achievements
Rank 1
answered on 10 Dec 2008, 06:50 PM
Hi -

First, how do you set columns in gridview to autosize?  I cannot seem to find any radgridview property for this.

Second, BestFit is not a member of Telerik.WinControls.UI.GridViewColumn, so that does not work either.  I am using the current release 8.1.0.0 (1204)

I would like my columns to automatically resize to fit the contents of the cells.

Thanks,
JB
0
Jack
Telerik team
answered on 12 Dec 2008, 09:16 AM
Hello John,

Thank you for contacting us.

You should call the BestFit method of GridViewDataColumn in order to resize a column in RadGridView. Call the BestFitColumns method of MasterGridViewTemplate to auto size all columns. Take a look at the following code snippet:

this.radGridView1.MasterGridViewTemplate.BestFitColumns(); 


Should you have any other questions, feel free to write us.

Kind regards,
Jack
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Asked by
Kristof
Top achievements
Rank 1
Answers by
Georgi
Telerik team
fgalarraga
Top achievements
Rank 1
Jack
Telerik team
jtby
Top achievements
Rank 1
Share this question
or