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 Select RadList View :(

      private void toolstripMenuCopy_Click(object sender, EventArgs e)
            {
                string temp = "";    
                
                for (int i = 0; i < radListView.SelectedItems.Count; i++)          
                {
     
                    temp = temp + listItem[radListView.SelectedIndex].ToString() + Environment.NewLine; 
                }           
                Clipboard.SetText(temp);
            }
     
    //listItem[] ={ "http://www.picasa.........", ...}


  2. Anton
    Admin
    Anton avatar
    167 posts

    Posted 02 Aug 2013 Link to this post

    Hello Huan,

    Thank you for writing.

    In order to find selected indexes, you can use one of the following approaches:
    string text="Selected items";
     
    foreach (ListViewDataItem item in radListView1.SelectedItems)
    {
        text += " " + radListView1.Items.IndexOf(item).ToString();
    }
     
    RadMessageBox.Show(text);
     
    string text = "Selected items";
     
    for (int i = 0; i < radListView1.Items.Count; i++)
    {
        if (this.radListView1.Items[i].Selected)
        {
            text += " " + i;
        }
    }
     
    RadMessageBox.Show(text);

    I hope this helps.

    Regards,
    Anton
    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