Multiple Cells Selection

4 posts, 0 answers
  1. Hendra
    Hendra avatar
    2 posts
    Member since:
    Jul 2012

    Posted 06 Jul 2009 Link to this post

    I was searching through the samples, but I cannot find a sample code that will enable the user to perform multi cells selection. The user needs to be able to select multiple cell from the same row or other rows. Each selected cells will have different background and foreground color.

    Thank you,
    Hendra
  2. Jack
    Admin
    Jack avatar
    2333 posts

    Posted 07 Jul 2009 Link to this post

    Hi Hendra,

    Thank you for contacting us.

    You should set RadGridView.MultiSelect property to true and RadGridView.SelectionMode to CellSelect. This will turn on the multiple cell selection mode. Please take a look at the Selection example in our Demo application. It demonstrates this behavior in detail.

    You could use the Visual Style Builder to change cell appearance or you can use CellFormatting event. The IsSelected property indicates whether a cell is selected and the SelectedCells collection contains all selected cells.

    If you have any other questions, don' t hesitate to ask.

    Greetings,
    Jack
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Rami
    Rami avatar
    1 posts
    Member since:
    Feb 2012

    Posted 27 Feb 2012 Link to this post

    On GridView multi cell selection right click menu copy copies only one cell (the one that was right clicked) and that is different from Ctrl+C that copies multi cells. Why?
    When copy single or multi cell , on GridView, (by Ctrl+C/Ctrl+V or by menu) and paste it, “CellValidating” event and “ValueChanging” is NOT triggered (for each cell). Why?

  4. Jack
    Admin
    Jack avatar
    2333 posts

    Posted 29 Feb 2012 Link to this post

    Hello Rami,

    Thank you for bringing our attention to this issue. I logged it in our issue tracking system and it will be addressed in our upcoming Service Pack in mid-March. I updated also your Telerik points.

    You can work around the issue by replacing the default copy menu item with a custom one. Here is a sample:
    void radGridView1_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
    {
        foreach (RadMenuItemBase item in e.ContextMenu.Items)
        {
            if (item.Text == "Copy")
            {
                e.ContextMenu.Items.Remove(item);
                item.Dispose();
                break;
            }
        }
        RadMenuItem copyMenuItem = new RadMenuItem("Copy");
        copyMenuItem.Click += new EventHandler(copyMenuItem_Click);
        e.ContextMenu.Items.Insert(0, copyMenuItem);
    }
     
    void copyMenuItem_Click(object sender, EventArgs e)
    {
        this.radGridView1.MasterTemplate.Copy();
    }

    Should you have further questions, do not hesitate to contact us.
     
    Greetings,
    Jack
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Back to Top