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

Datagridview features missing in Radgridview?

3 Answers 136 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jan Hesselgren
Top achievements
Rank 1
Jan Hesselgren asked on 27 May 2008, 02:29 PM
Hello, I have been using the "old" DataGridView control, and there are some features that seem to be missing in the RadGridView.

Ctrl-A does not select all rows.

Ctrl-C does not copy selected row contents to clipboard.

I have tried to make my own implementation of these features but I can't find something similar to the DataGridView.GetClipboardContent-method.

Also, I couldn't find a way to ovverride the "Copy"-function that exists on the context-menu. Is there an event to subscribe on?

Thanks in advance!

3 Answers, 1 is accepted

Sort by
0
Accepted
Martin Vasilev
Telerik team
answered on 30 May 2008, 11:36 AM
Hi Jan Hesselgren,

Thank you for the questions.

Currently, RadGridView does not support built-in selection and copy with key combination. Nevertheless, you could achieve such behavior by using the KeyDown event. Please refer to the code-block below:

private void radGridView1_KeyDown(object sender, KeyEventArgs e) 
    if (e.KeyCode == Keys.A && e.Control) 
    { 
        for (int i = 0; i < this.radGridView1.MasterGridViewTemplate.RowCount; i++) 
        { 
            this.radGridView1.MasterGridViewTemplate.Rows[i].IsSelected = true
            this.radGridView1.GridElement.Update(GridUINotifyAction.StateChanged); 
        } 
    } 
    if (e.KeyCode == Keys.C && e.Control) 
    { 
        //change code below according to your custom logic when copy the current row 
        Clipboard.SetDataObject(this.radGridView1.CurrentRow.ToString()); 
    } 

To set some custom logic in context menu items, you could use the ContectMenuOpening event. There, you could access context menu items and implement your click event for a single item:

private void radGridView1_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e) 
    RadDropDownMenu contextMenu = e.ContextMenu; 
 
    contextMenu.Items[0].Click += new EventHandler(ContextMenuCopy_Click); 
 
void ContextMenuCopy_Click(object sender, EventArgs e) 
    MessageBox.Show("Copy click!"); 
 
I hope this helps. If you have other questions, do not hesitate to contact me again.

All the best,
Martin Vasilev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jan Hesselgren
Top achievements
Rank 1
answered on 02 Jun 2008, 07:39 AM
Thanks, that wasn't as complicated as I thought :)
0
Nikolay
Telerik team
answered on 02 Jun 2008, 09:16 AM
Hello Jan Hesselgren,

I am glad to hear that the issue has now been resolved. If you have additional questions, feel free to contact me.

All the best,
Nikolay
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
GridView
Asked by
Jan Hesselgren
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Jan Hesselgren
Top achievements
Rank 1
Nikolay
Telerik team
Share this question
or