11/19/11

RegularExpressionValidator- Kiểm tra tính hợp lệ của Email

View Code:
<%@ Page Language="C#" %>

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

<asp:Label
id="lblEmail"
Text="Email Address:"
AssociatedControlID="txtEmail"
Runat="server" />
<asp:TextBox
id="txtEmail"
Runat="server" />
<asp:RegularExpressionValidator
id="regEmail"
ControlToValidate="txtEmail"
Text="(Invalid email)"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
Runat="server" />

<br /><br />

<asp:Button
id="btnSubmit"
Text="Submit"
Runat="server" />

</div>
</form>
</body>
</html>
Bookmark and Share

0 comments:

Post a Comment

Next previous home

Cộng đồng yêu thiết kế Việt Nam Thiet ke website, danang