CSDN博客

img bgu

[我的ASP.net学习历程]RegularExpressionValidator

发表于2004/9/21 20:03:00  635人阅读

<%@ Page Language="C#" AutoEventWireup="True" %>
<Script language="C#" runat="server">
void Page_Load(Object Sender,EventArgs e){

}
void ButtonClick(Object Sender,EventArgs E){
 if (Page.IsValid){
  Label_1.Text=TextBox_1.Text;
  }
 else{
  Label_1.Text="Error input!";
  }
}
</Script>
<form id="Form_1" runat="server">
 <asp:textbox ID="TextBox_1" runat="server"/>
 <asp:RegularExpressionValidator id="RegularExpressionValidator1"
                     ControlToValidate="TextBox_1"
                     ValidationExpression=".*@.*/..*"
                     Display="Static"
                     EnableClientScript="false"
                     ErrorMessage="Error E-mail!"
                     runat="server"/>
 <asp:button ID="Button_1" Text="Button" OnClick="ButtonClick" runat="server"/>
</form>
<asp:label ID="Label_1" runat="server"></asp:label>

0 0

相关博文

我的热门文章

img
取 消
img