Unable to get paste event from GridViewMaskedTextBoxColumn

2 posts, 0 answers
  1. Auvo
    Auvo avatar
    39 posts
    Member since:
    Jul 2011

    Posted 28 Feb 2013 Link to this post


    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

  2. Maya
    Maya avatar
    4062 posts

    Posted 05 Mar 2013 Link to this post

    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()
                DataObject.AddPastingHandler(this, new DataObjectPastingEventHandler(OnPaste));    
            private void OnPaste(object sender, DataObjectPastingEventArgs e)

    Will that approach fit into your requirements ?  

    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top