0

How can i customize a RadRumeric TextBox for mobile number validation. am using a RadRumeric TextBox for validating numbers. while using the same for mobile number validation it allows . how can i avoid this?

 <telerik:RadNumericTextBox ID="txtphone" Skin="WebBlue" runat="server" ValidationGroup="contact" Width="90%" MaxLength="32" NumberFormat-DecimalDigits="0">
           <NumberFormat DecimalDigits="0" DecimalSeparator ="."/>
 </telerik:RadNumericTextBox>
 <span class="warning">*</span><br />
 <asp:RequiredFieldValidator ID="RequiredFieldValidator25" runat="server" ControlToValidate="txtphone" CssClass="warning" ErrorMessage="Enter contact no." ValidationGroup="contact"></asp:RequiredFieldValidator>

when i give DecimalSeparator ="" will throws error

  • possible duplicate of [How do you validate phone number in asp.net?](http://stackoverflow.com/questions/18585613/how-do-you-validate-phone-number-in-asp-net) – Trevor Jan 10 '15 at 05:57
  • @ Codexer : these reference will shows validation of asp:testboxes. my question was about telerik RadNemeric textbox –  Jan 10 '15 at 06:31
  • 1
    What is the exact number format that you want to be entered? Also is there a reason you are using RadNumberTextBox instead of something like RadMaskedTextBox or RegExpTextBoxSetting? – Joe Uhren Jan 10 '15 at 07:01
  • something like 9876543210 only 10 digit number –  Jan 10 '15 at 09:32

2 Answers2

0

Try using the RadMastedTextBox for validating your numbers as it was designed for this sort of thing:

<telerik:RadMaskedTextBox ID="txtphone" runat="server" Label="mobile phone #: " Width="250px" SelectionOnFocus="CaretToBeginning" Mask="(###) ###-####" TextMode="SingleLine" />
Joe Uhren
  • 1,342
  • 1
  • 13
  • 27
0

This will work for the numbers which begin from 0,+91 or 9... etc.

<asp:TextBox ID="ph" runat="server"></asp:TextBox>

 <asp:RegularExpressionValidator ID="regx" runat="server" ControlToValidate="ph" ErrorMessage="*Enter valid Mobile Number"  ForeColor="Red" ValidationExpression="^[0][0-9]{10}|^[+91][0-9]{12}|[0-9]{10}"></asp:RegularExpressionValidator>
saish
  • 1