1 February 2014

Validation to allow only aplhabet charecters in textbox



<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="UI.WebForm1" %>

<!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></title>
</head>

<body>
    <form id="form1" runat="server">
    <div>
        <center>
            <asp:TextBox ID="txt_number" runat="server"></asp:TextBox>
            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txt_number"
                ErrorMessage="Please enter alphabetic characters " ValidationExpression="[a-zA-Z]+"></asp:RegularExpressionValidator>
        </center>

    </div>
    </form>
</body>

</html>

No comments:

Post a Comment