Add new item to generic list datasource not displaying in listview

2 posts, 0 answers
  1. David
    David avatar
    5 posts
    Member since:
    Nov 2011

    Posted 07 Dec 2011 Link to this post

    I have a few listviews, each bound to a generic list of a simple class. When the user clicks a button I want to remove an item from one list and add it to another. I am able to do this just fine but the listview does not refresh it's contents. What is the method required to rebind or reload the bound data?
  2. Ivan Todorov
    Ivan Todorov avatar
    688 posts

    Posted 08 Dec 2011 Link to this post

    Hi David,

    Thank you for contacting us.

    If you are using the generic List class, then you would have to reset RadListView's data source every time you insert or delete items from your list. This can be achieved as it is shown below:
    this.radListView1.DataSource = null;
    this.radListView1.DataSource = myList;

    A better approach is to use BindingList instead of List. The BindingList sends notifications when you modify its contents and RadListView will automatically reflect them.

    I hope you find this helpful. In case you have any additional questions, do not hesitate to contact us.

    Ivan Todorov
    the Telerik team

    Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

  3. DevCraft R3 2016 release webinar banner
Back to Top