RegularExpressionValidator

Posted by mohammedr88-18313 under ASP.NET on 3/14/2013 | Points: 10 | Views : 1278 | Status : [Member] | Replies : 3
Dear All


how to use RegularExpressionValidator for only numbers

thanks in advance




Responses

Posted by: Sabarimahesh on: 3/14/2013 [Member] Bronze | Points: 25

Up
0
Down
ValidationExpression="^[a-zA-Z0-9]*$"

Life is a Race
Thanks & Regards
By
Sabari Mahesh P M

mohammedr88-18313, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Satyapriyanayak on: 3/14/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm7.aspx.cs" Inherits="WebApplication17.WebForm7" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>

</div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ControlToValidate="TextBox1" ErrorMessage="RegularExpressionValidator"
ValidationExpression="\d+"></asp:RegularExpressionValidator>
</form>
</body>
</html>



You can try also

ValidationExpression="^\d+$"


If this post helps you mark it as answer
Thanks

mohammedr88-18313, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: mohammedr88-18313 on: 3/14/2013 [Member] Starter | Points: 25

Up
0
Down
thanks

mohammedr88-18313, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response