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

prevent ctrl+c in read only cell

1 Answer 106 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Emilio
Top achievements
Rank 1
Emilio asked on 17 Jul 2012, 01:53 AM
Hi,

How do i prevent/trap the ctrl+c (paste) in a read only cell.

Thanks,

1 Answer, 1 is accepted

Sort by
0
Svett
Telerik team
answered on 19 Jul 2012, 01:05 PM
Hi Emilio,

We know about this issue. It has already been addressed for the upcoming service pack. Meantime, you can create a custom grid behavior that handles this case:

public class MyGridBehavior : BaseGridBehavior
{
    public override bool ProcessKey(KeyEventArgs keys)
    {
        if (keys.Control && keys.KeyCode == Keys.V && this.GridControl.CurrentColumn != null && this.GridControl.CurrentColumn.ReadOnly)
        {
            return false;
        }
 
        return base.ProcessKey(keys);
    }
}

Then you should replace the default one:
this.radGridView1.GridBehavior = new MyGridBehavior();

Regards,
Svett
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
GridView
Asked by
Emilio
Top achievements
Rank 1
Answers by
Svett
Telerik team
Share this question
or