This question is locked. New answers and comments are not allowed.
Hello,
I have the following bit of code, to dynamically create a GridView with a random number of columns.
The DataTable/DataColumn are from this blog: http://blogs.telerik.com/vladimirenchev/posts/09-04-23/lightweight-datatable-for-your-silverlight-applications.aspx
This used to work fine with version 2011.2.712.1040. But with newer version (ex. 2011.3.1116.1040), it crashes on the last line (
In the older version, the RadGridView columns are generated as soon as the ItemsSource is set, witch is not the case in the newer version.
What has changed to make this stop working? Is there any way around?
Thank you,
Gen
I have the following bit of code, to dynamically create a GridView with a random number of columns.
The DataTable/DataColumn are from this blog: http://blogs.telerik.com/vladimirenchev/posts/09-04-23/lightweight-datatable-for-your-silverlight-applications.aspx
using Telerik.Data;... DataTable gridSource = new DataTable(); gridSource.Columns.Add(new DataColumn() { ColumnName = "ID", DataType = typeof(Int32) });gridSource.Columns.Add(new DataColumn() { ColumnName = "USERID", DataType = typeof(Int32) });gridSource.Columns.Add(new DataColumn() { ColumnName = "FULLNAME", DataType = typeof(String) });gridSource.Columns.Add(new DataColumn() { ColumnName = "DATESTART", DataType = typeof(DateTime) });gridSource.Columns.Add(new DataColumn() { ColumnName = "DATEEND", DataType = typeof(DateTime) }); int iColumnId = 0;foreach (int week in MyDynamicNbOfWeeks){ iColumnId++; gridSource.Columns.Add(new DataColumn() { ColumnName = "date" + iColumnId.ToString(), DataType = typeof(Decimal) });} //bind the datatable to the grid.radTimeLineGridView.ItemsSource = gridSource; radTimeLineGridView.Columns[0].IsVisible = false;//problem hereThis used to work fine with version 2011.2.712.1040. But with newer version (ex. 2011.3.1116.1040), it crashes on the last line (
radTimeLineGridView.Columns[0].IsVisible = false;) because the Columns list is empty. In the older version, the RadGridView columns are generated as soon as the ItemsSource is set, witch is not the case in the newer version.
What has changed to make this stop working? Is there any way around?
Thank you,
Gen