Advertisement
LonelyShepherd

Control Validation & Rich Controls [Лаб. 2.2.1]

Mar 13th, 2018
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASP 11.04 KB | None | 0 0
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication2.WebForm1" %>
  2.  
  3. <!DOCTYPE html>
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head runat="server">
  7.     <title></title>
  8.     <style type="text/css">
  9.         .auto-style1 {
  10.             height: 23px;
  11.         }
  12.         .auto-style2 {
  13.             height: 26px;
  14.         }
  15.     </style>
  16. </head>
  17. <body>
  18.     <form id="form1" runat="server">
  19.         <div>
  20.             <asp:MultiView ID="MultiView1" runat="server">
  21.                 <asp:View ID="View1" runat="server">
  22.                     <table>
  23.                         <tr>
  24.                             <td>Име</td>
  25.                             <td>
  26.                                 <asp:TextBox ID="TextBox1" runat="server" ValidationGroup="View1_Group"></asp:TextBox>
  27.                                 <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" Display="None" ErrorMessage="Внеси име" ValidationGroup="View1_Group"></asp:RequiredFieldValidator>
  28.                             </td>
  29.                         </tr>
  30.                         <tr>
  31.                             <td class="auto-style2">Презиме</td>
  32.                             <td class="auto-style2">
  33.                                 <asp:TextBox ID="TextBox2" runat="server" ValidationGroup="View1_Group"></asp:TextBox>
  34.                                 <asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" ControlToValidate="TextBox2" Display="None" ErrorMessage="Внеси презиме" ValidationGroup="View1_Group"></asp:RequiredFieldValidator>
  35.                             </td>
  36.                         </tr>
  37.                         <tr>
  38.                             <td class="auto-style1">ФИНКИ ID</td>
  39.                             <td class="auto-style1">
  40.                                 <asp:TextBox ID="TextBox3" runat="server" ValidationGroup="View1_Group"></asp:TextBox>
  41.                                 @finki.ukim.mk<asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" ControlToValidate="TextBox3" Display="None" ErrorMessage="Внеси ФИНКИ ID" ValidationGroup="View1_Group"></asp:RequiredFieldValidator>
  42.                                 <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" ControlToValidate="TextBox3" Display="None" ErrorMessage="Неправилен формат" ValidationExpression="^[a-z\d_]*\.?[a-z\d_]*$" ValidationGroup="View1_Group"></asp:RegularExpressionValidator>
  43.                             </td>
  44.                         </tr>
  45.                         <tr>
  46.                             <td class="auto-style1">Лозинка</td>
  47.                             <td class="auto-style1">
  48.                                 <asp:TextBox ID="TextBox4" runat="server" TextMode="Password" ValidationGroup="View1_Group"></asp:TextBox>
  49.                                 <asp:RequiredFieldValidator ID="RequiredFieldValidator13" runat="server" ControlToValidate="TextBox4" Display="None" ErrorMessage="Внеси лозинка" ValidationGroup="View1_Group"></asp:RequiredFieldValidator>
  50.                             </td>
  51.                         </tr>
  52.                         <tr>
  53.                             <td class="auto-style1">Потврда</td>
  54.                             <td class="auto-style1">
  55.                                 <asp:TextBox ID="TextBox5" runat="server" TextMode="Password" ValidationGroup="View1_Group"></asp:TextBox>
  56.                                 <asp:RequiredFieldValidator ID="RequiredFieldValidator14" runat="server" ControlToValidate="TextBox5" Display="None" ErrorMessage="Внеси потврда за лозинка" ValidationGroup="View1_Group"></asp:RequiredFieldValidator>
  57.                                 <asp:CompareValidator ID="CompareValidator2" runat="server" ControlToCompare="TextBox4" ControlToValidate="TextBox5" Display="None" ErrorMessage="Лозинките не се совпаѓаат" ValidationGroup="View1_Group"></asp:CompareValidator>
  58.                             </td>
  59.                         </tr>
  60.                         <tr>
  61.                             <td class="auto-style1" colspan="3">
  62.                                 <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="&gt;&gt;" ValidationGroup="View1_Group" />
  63.                             </td>
  64.                         </tr>
  65.                         <tr>
  66.                             <td class="auto-style1" colspan="2">
  67.                                 <asp:ValidationSummary ID="ValidationSummary1" runat="server" ForeColor="Red" ValidationGroup="View1_Group" />
  68.                             </td>
  69.                         </tr>
  70.                     </table>
  71.                 </asp:View>
  72.                 <asp:View ID="View2" runat="server">
  73.                     <table>
  74.                         <tr>
  75.                             <td class="auto-style1">Адреса</td>
  76.                             <td class="auto-style1">
  77.                                 <asp:TextBox ID="TextBox6" runat="server" ValidationGroup="View2_Group"></asp:TextBox>
  78.                                 <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="TextBox6" ErrorMessage="Внеси адреса" ForeColor="Red" ValidationGroup="View2_Group"></asp:RequiredFieldValidator>
  79.                             </td>
  80.                         </tr>
  81.                         <tr>
  82.                             <td>Тел</td>
  83.                             <td>
  84.                                 <asp:TextBox ID="TextBox7" runat="server" ValidationGroup="View2_Group"></asp:TextBox>
  85.                                 <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="TextBox7" ErrorMessage="Внеси телефон" ForeColor="Red" ValidationGroup="View2_Group"></asp:RequiredFieldValidator>
  86.                                 <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="TextBox7" ErrorMessage="Неправилен формат" ForeColor="Red" ValidationExpression="^07[015-7]\d{6}$" ValidationGroup="View2_Group"></asp:RegularExpressionValidator>
  87.                             </td>
  88.                         </tr>
  89.                         <tr>
  90.                             <td>Пол</td>
  91.                             <td>
  92.                                 <asp:RadioButtonList ID="RadioButtonList1" runat="server" ValidationGroup="View2_Group">
  93.                                     <asp:ListItem>М</asp:ListItem>
  94.                                     <asp:ListItem>Ж</asp:ListItem>
  95.                                 </asp:RadioButtonList>
  96.                                 <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="RadioButtonList1" ErrorMessage="Избери пол" ForeColor="Red" ValidationGroup="View2_Group"></asp:RequiredFieldValidator>
  97.                             </td>
  98.                         </tr>
  99.                         <tr>
  100.                             <td>Датум на раѓање</td>
  101.                             <td>
  102.                                 <asp:Calendar ID="Calendar1" runat="server" FirstDayOfWeek="Sunday" VisibleDate="1985-06-01"></asp:Calendar>
  103.                             </td>
  104.                         </tr>
  105.                         <tr>
  106.                             <td colspan="3">
  107.                                 <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="&lt;&lt;" />
  108.                                 <asp:Button ID="Button3" runat="server" OnClick="Button3_Click" Text="&gt;&gt;" ValidationGroup="View2_Group" />
  109.                             </td>
  110.                         </tr>
  111.                     </table>
  112.                 </asp:View>
  113.                 <asp:View ID="View3" runat="server">
  114.                     <table>
  115.                         <tr>
  116.                             <td>Занимање</td>
  117.                             <td>
  118.                                 <asp:DropDownList ID="DropDownList1" runat="server" ValidationGroup="View3_Group">
  119.                                     <asp:ListItem>-занимање-</asp:ListItem>
  120.                                     <asp:ListItem>Занимање 1</asp:ListItem>
  121.                                     <asp:ListItem>Занимање 2</asp:ListItem>
  122.                                     <asp:ListItem>Занимање 3</asp:ListItem>
  123.                                     <asp:ListItem>Занимање 4</asp:ListItem>
  124.                                     <asp:ListItem>Занимање 5</asp:ListItem>
  125.                                 </asp:DropDownList>
  126.                                 <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ControlToValidate="DropDownList1" ErrorMessage="Избери занимање" ForeColor="Red" InitialValue="-занимање-" ValidationGroup="View3_Group"></asp:RequiredFieldValidator>
  127.                             </td>
  128.                         </tr>
  129.                         <tr>
  130.                             <td class="auto-style2">Години на вршење на избраната дејност</td>
  131.                             <td class="auto-style2">
  132.                                 <asp:TextBox ID="TextBox8" runat="server" ValidationGroup="View3_Group"></asp:TextBox>
  133.                                 <asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ControlToValidate="TextBox8" ErrorMessage="Внеси години" ForeColor="Red" ValidationGroup="View3_Group"></asp:RequiredFieldValidator>
  134.                                 <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ControlToValidate="TextBox8" ErrorMessage="Недозволена вредност" ForeColor="Red" ValidationExpression="^\d+$" ValidationGroup="View3_Group"></asp:RegularExpressionValidator>
  135.                             </td>
  136.                         </tr>
  137.                         <tr>
  138.                             <td colspan="3">
  139.                                 <asp:Button ID="Button4" runat="server" Text="&lt;&lt;" OnClick="Button4_Click" />
  140.                                 <asp:Button ID="Button5" runat="server" Text="Поднеси" ValidationGroup="View3_Group" OnClick="Button5_Click" />
  141.                             </td>
  142.                         </tr>
  143.                     </table>
  144.                 </asp:View>
  145.                 <asp:View ID="View4" runat="server">
  146.                     <table>
  147.                         <tr>
  148.                             <td>
  149.                                 <asp:Label ID="Label1" runat="server"></asp:Label>
  150.                             </td>
  151.                         </tr>
  152.                         <tr>
  153.                             <td>
  154.                                 <asp:Button ID="Button6" runat="server" Text="Врати се на почеток" OnClick="Button6_Click1" />
  155.                             </td>
  156.                         </tr>
  157.                     </table>
  158.                 </asp:View>
  159.             </asp:MultiView>
  160.         </div>
  161.     </form>
  162. </body>
  163. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement