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

Listview selecting muliple indexes

1 Answer 69 Views
ListView
This is a migrated thread and some comments may be shown as answers.
HUAN
Top achievements
Rank 1
HUAN asked on 31 Jul 2013, 03:07 PM

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]

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 02 Aug 2013, 11:48 AM
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 >>
Tags
ListView
Asked by
HUAN
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or