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

Telerik.WinControls.UI.GridViewColumn' does not contain a definition for 'BestFit'

7 Answers 553 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 16 Jun 2009, 12:08 PM
Quarter 1 2009 Controls,  I have added referenes to all Telerik.WinControl.XXX and TelerikCommon and TelerikData but I am getting this error message.  This is an existing WinForms .net 2 application that I am adding some new forms to and I wanted to use the RadGridView control, but I am obviously missing a reference.  What do I need to add?

this.dummy_InventoryTableAdapter.Fill(this.dataSetDummy.Dummy_Inventory); 
foreach (GridViewColumn column in radGridViewInventory.Columns) 
    column.BestFit(); 


Thanks

Error    314    'Telerik.WinControls.UI.GridViewColumn' does not contain a definition for 'BestFit' and no extension method 'BestFit' accepting a first argument of type 'Telerik.WinControls.UI.GridViewColumn' could be found (are you missing a using directive or an assembly reference?) 

7 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 16 Jun 2009, 03:23 PM
Hello Paul,

Thank you for writing.

You are not missing any references, however, you are probably referencing a different version of the assemblies. This can happen for a number of reasons. One such reason is that Visual Studio caches assemblies in a few different places.

To solve this, remove your references from your project, clear your GAC, restart visual studio and add the references again.
 
Try the actions above and write back if  you need further assistance. 

Greetings,
Victor
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
Paul
Top achievements
Rank 1
answered on 24 Jun 2009, 10:43 AM
Thanks for the reply Victor, sorry for being slow getting back to you but I was pulled back to an asp.net project for a few days.

I did as you suggest but cleared the references from the GAC by uninstalling. I am not sure if you meant to do it another way.  I searched and found a reference to using GACUTIL.EXE but that said it could not remove any of the Telerik assemblies I tried to remove.

When I tried to uninstall and then reinstall the Winform controls, I got the same error as when I originally installed the winforms controls, ToolBox enocounted an error midway through.  Could this be causing the problem?

My setup is VS2008 SP1, XP Pro SP3, 1qtr 2009 Windows controls.  All of the references in the project are pointing to the Telerik install directory and pointing to the correct version numbers.  I have noticed some other problems with the winforms controls when using the designer.  Like if a RadButton or RadForm is open in the designer and the right bottom corner is out of view (ie, would need to scroll down in VS to see it.  If you build the solution with the right corners out of view, the border of the buttons and forms is not fully drawn.  It is only drawn correctly if you scroll down and resize the control forcing a repaint whilst the right bottom corner is in full view.

Thanks,
Paul


0
Victor
Telerik team
answered on 26 Jun 2009, 01:34 PM
Hello Paul,

We discovered which is the reason for the error you are experiencing ("Telerik.WinControls.UI.GridViewColumn' does not contain a definition for 'BestFit'"). The error is due to the fact that you are actually are having a foreach loop with GridViewColumn variables, but the GridViewColumn class does not have BestFit method. The BestFit method belongs to the GridViewDataColumn class and since the Columns collection of RadGridView contains only GridViewDataColumns, you foreach loop should look like this:
foreach (GridViewDataColumn column in radGridViewInventory.Columns)  
{  
    column.BestFit();  

Please excuse our omission on reviewing your code snippet.

As to the Toolbox error that you are getting please refer to this knowledge base articles which regards the case of manually installing RadControls for WinForms in your Toolbox.

I hope this helps. If you have additional questions, feel free to contact me.

All the best,
Victor
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
Paul
Top achievements
Rank 1
answered on 26 Jun 2009, 01:44 PM
Hi Victor,

Thanks for that.  I got the code from your online tutorial which is here:

This tutorial is incorrect

This shows using GridViewColumn not GridViewDataColumn

 private void Form1_Load(object  sender, EventArgs e) 
   this.categoriesTableAdapter.Fill(this.nwindDataSet.Categories); 
   foreach (GridViewColumn column in radGridView1.Columns) 
   { 
       column.BestFit(); 
   } 
}  

0
Nikolay
Telerik team
answered on 27 Jun 2009, 07:48 AM
Hello Paul,

Thank you for pointing this out for us.

The help article will be updated with the correct information in Q2 2009. I am updating your Telerik points for the feedback.

Kind regards,
Nikolay
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
Grant Drury-Green
Top achievements
Rank 1
answered on 24 Feb 2010, 01:11 AM
I'd like to point out that this documentation error has not been fixed in the RadPanel tutorial:

0
Nikolay
Telerik team
answered on 26 Feb 2010, 01:04 PM
Hello Grant Drury-Green,

Thank you for your feedback.

I am updating your Telerik points for it. The issue will be addressed shortly.

Sincerely yours,
Nikolay
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
GridView
Asked by
Paul
Top achievements
Rank 1
Answers by
Victor
Telerik team
Paul
Top achievements
Rank 1
Nikolay
Telerik team
Grant Drury-Green
Top achievements
Rank 1
Share this question
or