custom1.aspx 1009 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <%@ Page Language="C#" AutoEventWireup="True" %>
  2. <html>
  3. <head>
  4. <script runat="server">
  5. void ButtonClick(Object sender, EventArgs e)
  6. {
  7. if (Page.IsValid)
  8. {
  9. Label1.Text="Page is valid.";
  10. }
  11. else
  12. {
  13. Label1.Text="Page is not valid!!";
  14. }
  15. }
  16. </script>
  17. </head>
  18. <body>
  19. <form runat="server">
  20. <h3>CustomValidator Example</h3>
  21. Enter something
  22. <br>
  23. <asp:TextBox id="TextBox1"
  24. runat="server"/>
  25. <br>
  26. <asp:CustomValidator id="Custom1"
  27. ControlToValidate="TextBox1"
  28. ClientValidationFunction="OhBabyValidateMe"
  29. Text="Dude, watch what you're entering!"
  30. runat="server"/>
  31. <br><br>
  32. <asp:Label id="Label1"
  33. runat="server"/>
  34. <br><br>
  35. <asp:Button id="Button1"
  36. Text="Submit"
  37. OnClick="ButtonClick"
  38. runat="server"/>
  39. </form>
  40. </body>
  41. </html>