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

How to make Radgrid edit autoform save TextWithLiteral?

1 Answer 59 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
mqsash
Top achievements
Rank 1
mqsash asked on 30 Jan 2013, 01:11 AM
Hi 

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.

Thanks

1 Answer, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 01 Feb 2013, 01:21 PM
Hello mqsash,

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


Regards,
Vasil
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.
Tags
Ajax
Asked by
mqsash
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Share this question
or