Listview selecting muliple indexes

2 posts, 0 answers
  1. HUAN
    HUAN avatar
    2 posts
    Member since:
    Jul 2013

    Posted 31 Jul 2013 Link to this post

    Hello Telerik !
    How to get Selected Index of items from Multi Rad Select List View :(

    [url=http://upanh.com/view/?id=8vpe0zekflh][img]http://i5.upanh.com/2013/0731/15//57016499.untitled.png[/img][/url]

  2. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 02 Aug 2013 Link to this post

    Hello Huan,

    Thank you for contacting Telerik Support.

    In order to achieve your goal, you may use the following code snippet:
    public partial class Form1 : Form
       {
           public Form1()
           {
               InitializeComponent();
     
               this.radListView1.AllowArbitraryItemHeight = true;
               this.radListView1.MultiSelect = true;
           }
     
           private void radButton1_Click(object sender, EventArgs e)
           {
               StringBuilder indexes = new StringBuilder("You have selected item with index:");
               if (this.radListView1.MultiSelect)
               {
                    
                   ListViewSelectedItemCollection items = this.radListView1.SelectedItems;
                   foreach (ListViewDataItem item in items)
                   {
                       indexes.AppendFormat(" {0}", this.radListView1.Items.IndexOf(item));
                   }
               }
     
               this.radLabel1.Text = indexes.ToString();
           }
       }

    I hope this information helps. Should you have further questions, I would be glad to help.

    Regards,
    Desislava
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top