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

Trying to take first 10 rows from a datatable and use them as datasouce for grid.

1 Answer 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
fred williams
Top achievements
Rank 1
fred williams asked on 04 Apr 2011, 09:12 PM
I have a dataset that I'd like to take the first 10 rows from, and then bind them to my grid. Here's what I have:



DataTable dt = new DataTable();
for (int i = 0; i < 10; i++)
{
    dt.ImportRow(ds.Tables[0].Rows[i]);
    dt.AcceptChanges();
}
rgPreview.DataSource = dt;



I'm getting a "

Cannot find any bindable properties in an item from the datasource"

 error.

1 Answer, 1 is accepted

Sort by
0
fred williams
Top achievements
Rank 1
answered on 05 Apr 2011, 02:55 PM
FYI, I solved the problem this way:

DataTable dtNew = new DataTable();
dtNew = dtOld.Clone();
 
for(int i=0;i<10;i++)
{
    dtNew.importRow(dtOld.Rows[i]);
}
 
RadGrid1.DataSource = dtNew;
RadGrid.DataBind();

Hope this helps someone else out.
Tags
Grid
Asked by
fred williams
Top achievements
Rank 1
Answers by
fred williams
Top achievements
Rank 1
Share this question
or