What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 17973 |  Welcome, Guest!   Register  Login
 Home > Code Snippets > ASP.NET > RegularExpressionValidator for email address ...
Gopesh9

RegularExpressionValidator for email address

 Code Snippet posted by: Gopesh9 | Posted on: 8/3/2012 | Category: ASP.NET Codes | Views: 454 | Status: [Member] | Points: 40 | Alert Moderator   


<%@ 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>


G. S.
.Net Developer
Found interesting? Add this to:


 Responses

Srilu.Nayini577
Posted by: Srilu.Nayini577 | Posted on: 8/6/2012 | Level: Starter | Status: [Member] | Points: 10 | Alert Moderator 

Hi,
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<!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>
<asp:Label ID="Label1" runat="server"
style="z-index: 1; left: 315px; top: 114px; position: absolute" Text="Email"></asp:Label>

<asp:TextBox ID="txtemail" runat="server"
style="z-index: 1; left: 437px; top: 107px; position: absolute"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ControlToValidate="txtemail" ErrorMessage="Invalid email"
style="z-index: 1; top: 114px; position: absolute; left: 658px"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
style="z-index: 1; left: 398px; top: 214px; position: absolute; right: 483px"
Text="Button" />

</div>

</form>
</body>
</html>


Thank you,

SRILATHA
.Net Developer

>> Write Response - Respond to this post and get points

More codes snippets

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/24/2013 5:53:50 PM