ValidatorCallout控件,该控件用于用户控件中输入不符合格式要求的内容之后,提示操作错误信息。

<%...@PageLanguage="C#"AutoEventWireup="true"CodeFile="ValidatorCalloutDemo.aspx.cs"
Inherits="ValidatorCalloutDemo"%>


<%...@RegisterAssembly="System.Web.Extensions,Version=1.0.61025.0,Culture=neutral,
PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI"TagPrefix="asp"%>


<%...@RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1"%>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title>无标题页</title>
</head>
<body>
<formid="form1"runat="server">
<div>
<asp:ScriptManagerID="ScriptManager1"runat="server">
</asp:ScriptManager>
<table>
<tr>
<td>电子邮件:</td>
<td><asp:TextBoxrunat="server"ID="MailTextBox"BorderStyle="solid"
BorderWidth="1px"BorderColor="#a9a9a9"/></td>
</tr>
</table>
<br/>
<asp:RegularExpressionValidatorrunat="server"ID="PNRegEx"
ControlToValidate="MailTextBox"Display="None"ErrorMessage="<b>格式不正确</b><br/>请按如下格式填写<br/>carol@sina.com"ValidationExpression="w+([-+.']w+)*@w+([-.]w+)*.w+([-.]w+)*"/>
<asp:ButtonID="Button1"runat="server"Text="提交"/>
<cc1:ValidatorCalloutExtenderrunat="Server"ID="PNReqE"TargetControlID="PNRegEx"
Width="100px"/>
</div>
</form>
</body>
</html>


Inherits="ValidatorCalloutDemo"%>



PublicKeyToken=31bf3856ad364e35"






"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">














BorderWidth="1px"BorderColor="#a9a9a9"/></td>




ControlToValidate="MailTextBox"Display="None"ErrorMessage="<b>格式不正确</b><br/>请按如下格式填写<br/>carol@sina.com"ValidationExpression="w+([-+.']w+)*@w+([-.]w+)*.w+([-.]w+)*"/>


Width="100px"/>




