Format gridview textbox cell value while typing.

2 posts, 0 answers
  1. Evgeniy
    Evgeniy avatar
    1 posts
    Member since:
    Aug 2016

    Posted 24 Aug 2016 Link to this post


    I need to correctly format the phone number while user enter digits. Fixed mask is not sutable because the user can enter any number of any country.

    I have a special method which takes a string and returns correctly forrmatted number, however, it is not possible to change cell's value in Edit Mode cathing ValueChanging event. Is it any workaround?

    Best regards


  2. Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    4074 posts

    Posted 26 Aug 2016 Link to this post

    Hello Evgeniy,

    Thank you for writing. 

    GridViewMaskBoxColumn allows restricted editing of text/numeric data. It uses a RadMaskedEditBoxElement for the cell's editor. Thus, you can specify what mask to be followed including some optional digits as well. 

    However, if you don't want to use a GridViewMaskBoxColumn, indeed handling the ValueChanging event may suit your custom scenario. Note that you shouldn't modify the cell's value, but the editor's value while editing. The editor's value will be committed when you press enter or focus some other element. Additional information about the available masks can be found here:

    I hope this information helps. Should you have further questions I would be glad to help.

    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Back to Top