
Dhamodharan
Top achievements
Rank 1
Dhamodharan
asked on 28 Aug 2013, 07:09 PM
Hi,
I need to allow only alpha numeric value with some special chracters ('_','-','@','.').
Thanks
I need to allow only alpha numeric value with some special chracters ('_','-','@','.').
Thanks
5 Answers, 1 is accepted
0

Shinu
Top achievements
Rank 2
answered on 29 Aug 2013, 06:45 AM
Hi Dhamodharan,
RadTextBox can be used with RegularExpressionValidator to validate the input for a specific format. Please have a look at the following code I tried which works fine at my end.
ASPX:
Here the validation expression is
Thanks,
Shinu.
RadTextBox can be used with RegularExpressionValidator to validate the input for a specific format. Please have a look at the following code I tried which works fine at my end.
ASPX:
<
telerik:RadTextBox
ID
=
"RadTextBox1"
runat
=
"server"
>
</
telerik:RadTextBox
>
<
asp:RegularExpressionValidator
ID
=
"RegularExpressionValidator1"
runat
=
"server"
Display
=
"Dynamic"
ErrorMessage
=
"*"
ForeColor
=
"Red"
ValidationExpression
=
"^.*(?=.*[a-zA-Z])(?=.*\d)(?=.*[\.@_-]).*$"
ControlToValidate
=
"RadTextBox1"
>
</
asp:RegularExpressionValidator
>
<
br
/>
<
telerik:RadButton
ID
=
"RadButton1"
runat
=
"server"
Text
=
"Submit"
CausesValidation
=
"true"
>
</
telerik:RadButton
>
Here the validation expression is
^.* : Start
(?=.*[a-zA-Z]) : Letters
(?=.*\d) : Digits
(?=.*[\.@_-]) : Special characters
.*$ : End
Thanks,
Shinu.
0

Dhamodharan
Top achievements
Rank 1
answered on 29 Aug 2013, 08:15 AM
Hi Shinu,
Thanks for ur Reply.
It works as i should enter a text with alphabet with numeric and a specified special character.
It allows to enter other special character along with specified values. It checks as specified values are mandatory. But my requirement is to allow any type of values may be alphabets or may be numeric values or may be specified special characters or may be mixed of all as follows.
Correct values
ex: Telerik
ex: 000000
ex: telerik_fourms007
Invalid Values
ex: telerik_forums007$&% - due to wrong special chracters
Thanks
Thanks for ur Reply.
It works as i should enter a text with alphabet with numeric and a specified special character.
It allows to enter other special character along with specified values. It checks as specified values are mandatory. But my requirement is to allow any type of values may be alphabets or may be numeric values or may be specified special characters or may be mixed of all as follows.
Correct values
ex: Telerik
ex: 000000
ex: telerik_fourms007
Invalid Values
ex: telerik_forums007$&% - due to wrong special chracters
Thanks
0

Shinu
Top achievements
Rank 2
answered on 09 Sep 2013, 04:53 AM
Hi Dhamodharan,
Please try the following updated code to achieve your requirement.
ASPX:
Thanks,
Shinu.
Please try the following updated code to achieve your requirement.
ASPX:
<
telerik:RadTextBox
ID
=
"RadTextBox1"
runat
=
"server"
>
</
telerik:RadTextBox
>
<
asp:RegularExpressionValidator
ID
=
"RegularExpressionValidator1"
runat
=
"server"
Display
=
"Dynamic"
ErrorMessage
=
"*"
ForeColor
=
"Red"
ValidationExpression
=
"^[0-9a-zA-Z\.@_-]+$"
ControlToValidate
=
"RadTextBox1"
>
</
asp:RegularExpressionValidator
>
Thanks,
Shinu.
0

srinivas
Top achievements
Rank 1
answered on 24 Mar 2017, 11:27 AM
<telerik:RadTextBox ID="RadTextBox1" runat="server">
</telerik:RadTextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" Display="Dynamic"
ErrorMessage="*" ForeColor="Red" ValidationExpression="^.*(?=.*[a-zA-Z])(?=.*\d)(?=.*[\.@_-]).*$"
ControlToValidate="RadTextBox1">
</asp:RegularExpressionValidator>
<br />
<telerik:RadButton ID="RadButton1" runat="server" Text="Submit" CausesValidation="true">
</telerik:RadButton>
</telerik:RadTextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" Display="Dynamic"
ErrorMessage="*" ForeColor="Red" ValidationExpression="^.*(?=.*[a-zA-Z])(?=.*\d)(?=.*[\.@_-]).*$"
ControlToValidate="RadTextBox1">
</asp:RegularExpressionValidator>
<br />
<telerik:RadButton ID="RadButton1" runat="server" Text="Submit" CausesValidation="true">
</telerik:RadButton>
0

Pravin
Top achievements
Rank 1
answered on 08 Sep 2017, 08:09 AM
Thanks