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

C1 DataTable as ItemsSource

5 Answers 70 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Arjen
Top achievements
Rank 1
Arjen asked on 14 Aug 2009, 08:38 AM
Hello,

We are using a C1 DataTable as ItemsSource for a RadGridView. The data provided is shown, but when I click the filterbutton in the header or drop a column on the group area I get a white screen with the message: 'Test1' is not a member of type 'System.Object'. How can I use sorting, filtering and grouping with the C1 DataView?

My code:

---

      DataTable table = new DataTable();

      table.Columns.Add(new DataColumn("Id", typeof(int)));
      table.Columns.Add(new DataColumn("Test1", typeof(string)));
      table.Columns.Add(new DataColumn("Test2", typeof(string)));

      for (int i = 0; i < 100; i++)
      {
        DataRow row = table.NewRow();

        row["Id"] = i;
        row["Test1"] = Guid.NewGuid().ToString();
        row["Test2"] = Guid.NewGuid().ToString();

        table.Rows.Add(row);
      }

      TestGridView.Columns.Add(new GridViewDataColumn()
      {
        DataMemberBinding = new Binding("Id"),
        DataType = typeof(int),
        HeaderText = "Id"
      });

      TestGridView.Columns.Add(new GridViewDataColumn()
      {
        DataMemberBinding = new Binding("Test1"),
        DataType = typeof(string),
        HeaderText = "Test1"
      });

      TestGridView.Columns.Add(new GridViewDataColumn()
      {
        DataMemberBinding = new Binding("Test2"),
        DataType = typeof(string),
        HeaderText = "Test2"
      });

      TestGridView.ItemsSource = table.DefaultView;

---

Thanks,

Arjen

5 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 14 Aug 2009, 08:57 AM
Hello Arjen,

I'm not aware about C1 DataTable however you can try my DataTable where all operations like sorting, filtering, grouping, etc. will work just fine.

Sincerely yours,
Vlad
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
Arjen
Top achievements
Rank 1
answered on 14 Aug 2009, 11:16 AM
Hello Vlad,

Thanks for the quick reply. The problem is that the C1 DataTable is much used in our application and we can't just move to another...

Do you have any idea what is causing the problem?

Arjen
0
Vlad
Telerik team
answered on 14 Aug 2009, 11:33 AM
Hello Arjen,

Most probably the grid reflects these dynamic rows as typeof(object) and that is why cannot find any properties. I will gladly help you if you can send us small example (via support ticket) where this problem can be reproduced.

All the best,
Vlad
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
Scott Rakestraw
Top achievements
Rank 1
answered on 21 Sep 2009, 01:41 PM
I'm having this same issue.  Is there any resolution to this problem?
0
Arjen
Top achievements
Rank 1
answered on 21 Sep 2009, 01:57 PM
Hi Scott,

We eventually moved to another grid, so I don't have a solution... sorry.

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