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

RadGridView WPF: NotSupportedException

2 Answers 56 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Pascal
Top achievements
Rank 1
Pascal asked on 26 Jan 2010, 02:13 PM
Hi,

I am trying to set a DataTable as ItemsSource for a RadGridView and get the following exception:

   at System.Linq.Enumerable.<CastIterator>d__aa`1.System.Collections.IEnumerator.Reset()
   at Telerik.Windows.Data.EnumerableExtensions.TryGetFirstElementType(IEnumerable source, Type& firstElementType) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\EnumerableExtensions.cs:line 54

I do the following:

DataTable

 

dataTable = new DataTable();

 

 

string[] values = dataValue.Value.Split(',');

 

 

for (int i = 0; i < values.Length; i++)

 

{

dataTable.Columns.Add(i.ToString(),

typeof(string));

 

}

dataTable.Rows.Add(values);

 

this.radGridView1.AutoGenerateColumns = true;

 

 

this.radGridView1.ItemsSource = dataTable;

 



Anybody has some suggestions what I am doing wrong here?

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 26 Jan 2010, 02:49 PM
Hi,

I've just tried this however everything worked fine on my end - you can check the attached project for reference.

Sincerely yours,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Pascal
Top achievements
Rank 1
answered on 26 Jan 2010, 03:18 PM
Hi,

thanks for the fast answer. Your example works fine, but in my application it still crashes, even if I use exactly your example code.
I have the same Telerik Version as you. The only difference is, I open the RadGrid in a seperate Window and open it using ShowDialog?!
If I use the dataTable.DefaultView as ItemsSource it works...
Very strange.

Tags
GridView
Asked by
Pascal
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Pascal
Top achievements
Rank 1
Share this question
or