ASP.NET HTML 控件 RegularExpressionValidator

asp.net html 控件 regularexpressionvalidator

<script  runat="server">
sub submit(sender as object, e as eventargs) 
if page.isvalid then 
   lbl.text="the page is valid!"
else 
   lbl.text="the page is not valid!"
end if
end sub
</script>


<!doctype html>
<html>
<body>

<form runat="server">
enter a us zip code:
<asp:textbox id="txtbox1" runat="server" />
<br><br>
<asp:button text="submit" onclick="submit" runat="server" />
<br><br>
<asp:label id="lbl" runat="server" />
<br>
<asp:regularexpressionvalidator 
controltovalidate="txtbox1"
validationexpression="\d{5}"
enableclientscript="false"
errormessage="the zip code must be 5 numeric digits!"
runat="server" />
</form>

</body>
</html>
相关文章