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

How to copy radgridview.Itemsource data to list type

1 Answer 266 Views
GridView
This is a migrated thread and some comments may be shown as answers.
kavitha
Top achievements
Rank 1
kavitha asked on 12 Nov 2012, 04:45 PM
Hi telerik team,
Is this possible copy the radgridview.Itemsource data to list.

ex: List<string>  data=radgridview.Itemsource. 

Can you give any examples or links 

1 Answer, 1 is accepted

Sort by
0
Accepted
Yoan
Telerik team
answered on 15 Nov 2012, 03:09 PM
Hi Kavi,


Actually, If you want to copy RadGridView's ItemsSource to a List you can do it like so:
void radGridView1_DataLoaded(object sender, EventArgs e)
       {
       List<Employee> copy = new List<Employee>((this.radGridView1.ItemsSource as IList).OfType<Employee>());
       }

Note that you should do this in GridView's DataLoaded event, because in other way the bindings of radGridView1 would not be ready. 

If that not helps you, may I ask you to give more details about you scenario?

 

Regards,
Yoan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
kavitha
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Share this question
or