8 Answers, 1 is accepted
0
Hi Tuan Pham,
There is a way to access the "BestFit" method, even though the API is not quite "pleasant". Here is a code snipped that does it:
I also prepared you a sample application that deomnstrates this functionality. Please find it attached.
We are currently enhancing the API, including the one related to this functionality. The more "clear" version will be introduced no later than SP1, that is expected in about three weeks.
Kind regards,
Mike
the telerik team
Instantly find answers to your questions at the new Telerik Support Center
There is a way to access the "BestFit" method, even though the API is not quite "pleasant". Here is a code snipped that does it:
GridHeaderRowElement headerElement = (GridHeaderRowElement) ((GridTableElement) this.radGridView1.GridElement).TableBodyElement.Children[0]; |
headerElement.BestFitColumn(radGridView1.MasterGridViewTemplate.Columns.FindByDataField("CompanyName") ); |
I also prepared you a sample application that deomnstrates this functionality. Please find it attached.
We are currently enhancing the API, including the one related to this functionality. The more "clear" version will be introduced no later than SP1, that is expected in about three weeks.
Kind regards,
Mike
the telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

Erik
Top achievements
Rank 1
answered on 10 Jul 2007, 05:31 AM
Hi,
Can I have the code in VB.Net?
Thanks
Can I have the code in VB.Net?
Thanks
0
Hello eriksurya,
Here is attached the same project, converted VB.Net.
If you have any other questions, please do not hesitate to write back.
All the best,
Georgi
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Here is attached the same project, converted VB.Net.
If you have any other questions, please do not hesitate to write back.
All the best,
Georgi
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

Craig Finnigan
Top achievements
Rank 1
answered on 28 Apr 2009, 07:43 PM
Has a more elegant way of this been released witht he Q1 2009 SP1?
0
Hello Craig Finnigan,
Thank you for the question.
Yes, currently you can use the GridViewTemplate BestFitColumns method:
Do not hesitate to contact me again if you have other questions.
Greetings,
Martin Vasilev
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.
Thank you for the question.
Yes, currently you can use the GridViewTemplate BestFitColumns method:
this.radGridView1.MasterGridViewTemplate.BestFitColumns(); |
Do not hesitate to contact me again if you have other questions.
Greetings,
Martin Vasilev
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

Kris
Top achievements
Rank 1
answered on 08 Apr 2011, 03:30 AM
Am I missing something here? I am trying to have all my columns adjust to the best fit and nothing seems to happen.
I am databinding to a list of custom objects.
radGridView1.DataSource = dictionary;
radGridView1.MasterTemplate.BestFitColumns();
I am databinding to a list of custom objects.
public class dict
{
public string DictionaryCode { get; set; }
public int AttributeMarkCount { get; set; }
public string Heading { get; set; }
public string Structure { get; set; }
public string Reserve1 { get; set; }
public string Reserve2 { get; set; }
public string OutputConversionCode { get; set; }
public string ProcessingCode { get; set; }
public string Justification { get; set; }
public string Width { get; set; }
public string Reserve3 { get; set; }
public string Reserve4 { get; set; }
public string Reserve5 { get; set; }
public string InputConversionCode { get; set; }
public string Macro { get; set; }
public string Reserver6 { get; set; }
}
List<dict> dictionary = new List<dict>();
.... Add a bunch of items....
Well it looks like it is working but only when I re size the grid does it draw correctly.
I tried radgridview.Refresh(); but it still only works after a re size.
0

Kris
Top achievements
Rank 1
answered on 08 Apr 2011, 06:06 AM
I figured this out. Program structure issue.
0
Hello kris munroe,
I am glad you have found a solution for the experienced issue. Let me know if you have any additional questions.
Best wishes,
Martin Vasilev
the Telerik team
I am glad you have found a solution for the experienced issue. Let me know if you have any additional questions.
Best wishes,
Martin Vasilev
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