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

Unable to get paste event from GridViewMaskedTextBoxColumn

1 Answer 125 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Auvo
Top achievements
Rank 1
Auvo asked on 28 Feb 2013, 11:20 AM
Hi,

When I paste data from clipboard to the RadGriView cell, which type is GridViewMaskedTextBoxColumn, I need to validate the data and trim out some empty spaces from clipboard data before pasting it to the cell.

How can I do that?

I tried to use PastingCellClipboardContext-event but it not raised when GridViewMaskedTextBoxColumn cell is in editing mode.

I create maskedtext type of columns in code behind...
GridViewMaskedTextBoxColumn column = new GridViewMaskedTextBoxColumn();
column.DataMemberBinding = new Binding(bindKey);
column.Header = headerText;
column.UniqueName = uniqueName;
column.IsReadOnly = readOnly;
column.TextAlignment = textAlign;
column.MaskType = MaskType.Standard;
column.Mask = mask;


and I'm using RadControls version 2012.1.326.40

Regards,
Auvo

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 05 Mar 2013, 09:38 AM
Hello Auvo,

Actually, when you are in edit mode, the editing element is the one handling the pasting logic. What you can try is to add an event handler as:

public MainWindow()
        {
            this.InitializeComponent();
            DataObject.AddPastingHandler(this, new DataObjectPastingEventHandler(OnPaste));    
        }
 
        private void OnPaste(object sender, DataObjectPastingEventArgs e)
        {
             
        }

Will that approach fit into your requirements ?  

Regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Auvo
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or