ValidationSummaryCS.aspx 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <%@ Page Language="C#" %>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" >
  4. <head id="Head1" runat="server">
  5. <title>Validation Summary Example</title>
  6. </head>
  7. <body>
  8. <form id="form1" runat="server">
  9. <asp:ScriptManager ID="ScriptManager1" runat="server" />
  10. <asp:UpdatePanel runat="server">
  11. <ContentTemplate>
  12. <table cellpadding="10">
  13. <tr>
  14. <td>
  15. <table style="background-color:#eeeeee; padding:10">
  16. <tr>
  17. <td colspan="3">
  18. <b>Credit Card Information</b>
  19. </td>
  20. </tr>
  21. <tr>
  22. <td align="right">
  23. Card Type:
  24. </td>
  25. <td>
  26. <asp:RadioButtonList id="RadioButtonList1"
  27. RepeatLayout="Flow"
  28. runat="server">
  29. <asp:ListItem>MasterCard</asp:ListItem>
  30. <asp:ListItem>Visa</asp:ListItem>
  31. </asp:RadioButtonList>
  32. </td>
  33. <td align="center" rowspan="1">
  34. <asp:RequiredFieldValidator
  35. id="RequiredFieldValidator1"
  36. ControlToValidate="RadioButtonList1"
  37. ErrorMessage="Card Type."
  38. Display="Static"
  39. InitialValue=""
  40. Width="100%"
  41. Text="*"
  42. runat="server"/>
  43. </td>
  44. </tr>
  45. <tr>
  46. <td align="right">
  47. Card Number:
  48. </td>
  49. <td>
  50. <asp:TextBox id="TextBox1"
  51. runat="server" />
  52. </td>
  53. <td>
  54. <asp:RequiredFieldValidator
  55. id="RequiredFieldValidator2"
  56. ControlToValidate="TextBox1"
  57. ErrorMessage="Card Number. "
  58. Display="Static"
  59. Width="100%"
  60. Text="*"
  61. runat="server"/>
  62. </td>
  63. </tr>
  64. <tr>
  65. <td></td>
  66. <td>
  67. <asp:Button id="Button1"
  68. Text="Validate"
  69. runat="server" />
  70. </td>
  71. <td></td>
  72. </tr>
  73. </table>
  74. </td>
  75. <td valign="top">
  76. <table cellpadding="20">
  77. <tr>
  78. <td>
  79. <asp:ValidationSummary id="valSum"
  80. DisplayMode="BulletList"
  81. EnableClientScript="true"
  82. HeaderText="You must enter a value in the following fields:"
  83. runat="server"/>
  84. </td>
  85. </tr>
  86. </table>
  87. </td>
  88. </tr>
  89. </table>
  90. </ContentTemplate>
  91. </asp:UpdatePanel>
  92. </form>
  93. </body>
  94. </html>