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

datatable to object table

1 Answer 56 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
manuel
Top achievements
Rank 1
manuel asked on 16 Mar 2016, 05:54 PM

Hi, I need help.

 

I am using c #, and I'm working on a report which I have an object table which I want to fill a DataTable by code, I tried this way but it did not work.

 

DataTable table = new DataTable("patients");
table.Columns.Add("name");
table.Columns.Add("id");
table.Rows.Add("sam", 1);
table.Rows.Add("mark", 2);
table1.DataSource = table;

prints the rows that have this datatable(2), but empty.

 

1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 18 Mar 2016, 12:49 PM
Hello Manuel,

You will need to use an ObjectDataSource component at design-time to bind the table to data. For more information, please refer to the ObjectDataSource Component help articles.

Regards,
Nasko
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
manuel
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or