How to make Radgrid edit autoform save TextWithLiteral?

2 posts, 0 answers
  1. mqsash
    mqsash avatar
    31 posts
    Member since:
    May 2012

    Posted 29 Jan 2013 Link to this post


    We have a requirement where we want to save phone numbers into the DB along with the formatting of (###) ###-#### .

    These numbers are entered on a RadGrid, where I use a GridMaskedColumn with a Mask of (###) ###-####  so that the auto-edit form displays the mask for the user when he is entering the number.
    But once the user has entered the number and presses the insert link, it the numbers w/o the formatting into the DB field.

    Question: How do I set up my GridMaskedColumn (or any other type of GridColumn) so that the generated edit form will have the text field with the Mask and also insert / update the data along with the mask?

    FWIW - I found that the MaskedTextBox control has a TextWithLiterals property which returns the string with the formatting, but I'm not sure how to force the edit form to save this TextWithLiterals instead of just the Text.

    Any guidance will be very much appreciated.

  2. Vasil
    Vasil avatar
    1638 posts

    Posted 01 Feb 2013 Link to this post

    Hello mqsash,

    You can use GridTemplateColumn, and place RadMaskedTextBox inside. You can bind to the TextWithLiterals as well:
        <telerik:RadMaskedTextBox runat="server" TextWithLiterals="<%#Bind("YourDataField") %>">                               

    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top