How to copy radgridview.Itemsource data to list type

2 posts, 1 answers
  1. kavitha
    kavitha avatar
    10 posts
    Member since:
    Jun 2011

    Posted 12 Nov 2012 Link to this post

    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 
  2. Answer
    Yoan avatar
    1215 posts

    Posted 15 Nov 2012 Link to this post

    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?


    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top