home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / NETFrameworkSDK.exe / comsdk.cab / samples.exe / QuickStart / aspplus / samples / apps / pagestate1.aspx < prev    next >
Encoding:
Text File  |  2000-05-31  |  6.0 KB  |  164 lines

  1. <%@ Register TagPrefix="Acme" TagName="Address" Src="address.aspc" %>
  2.  
  3. <html>
  4.  
  5.   <script language="C#" runat="server">
  6.  
  7.       void Page_Load(Object Src, EventArgs E ) {
  8.       
  9.          if (!IsPostBack)
  10.            State["PanelIndex"] = 0;
  11.       }
  12.  
  13.       void Next_Click(Object Src, EventArgs E ) {
  14.       
  15.          String PrevPanelId = "Panel" + State["PanelIndex"].ToString();
  16.          State["PanelIndex"] = (int)State["PanelIndex"] + 1;
  17.          String PanelId = "Panel" + State["PanelIndex"].ToString();
  18.  
  19.          Panel p = (Panel)FindControl(PanelId);
  20.          p.Visible=true;
  21.  
  22.          p = (Panel)FindControl(PrevPanelId);
  23.          p.Visible=false;
  24.       }
  25.  
  26.       void Prev_Click(Object Src, EventArgs E ) {
  27.       
  28.          String PanelId = "Panel" + State["PanelIndex"].ToString();
  29.          State["PanelIndex"] = (int)State["PanelIndex"] - 1;
  30.          String PrevPanelId = "Panel" + State["PanelIndex"].ToString();
  31.  
  32.          Panel p = (Panel)FindControl(PanelId);
  33.          p.Visible=false;
  34.  
  35.          p = (Panel)FindControl(PrevPanelId);
  36.          p.Visible=true;
  37.       }
  38.  
  39.       void Finish_Click(Object Src, EventArgs E ) {
  40.       
  41.          String PanelId = "Panel" + State["PanelIndex"].ToString();
  42.          Panel p = (Panel)FindControl(PanelId);
  43.          p.Visible=false;
  44.  
  45.          MyLabel.Text += "<b>Thank You!  We received the following information: </b><p>";
  46.          MyLabel.Text += "First Name: " + FirstName.Value + "<br>";
  47.          MyLabel.Text += "Last Name: " + LastName.Value + "<br>";
  48.          MyLabel.Text += "Address: " + Address.Address + "<br>";
  49.          MyLabel.Text += "City: " + Address.City + "<br>";
  50.          MyLabel.Text += "State: " + Address.State + "<br>";
  51.          MyLabel.Text += "Zip: " + Address.Zip + "<br>";
  52.          MyLabel.Text += "Card Number: " + CardNum.Value + "<br>";
  53.          MyLabel.Text += "Card Type: " + CardType.Value + "<br>";
  54.          MyLabel.Text += "Expires: " + Expires.Value + "<br>";
  55.       }
  56.  
  57.   </script>
  58.  
  59.   <body style="font: 10pt verdana">
  60.  
  61.     <h3><font face="Verdana">Using PageState</font></h3>
  62.  
  63.     <form runat="server">
  64.  
  65.     <ASP:Panel id="Panel0" Visible="true" runat="server">
  66.       <table width="500" height="200" style="font:10pt verdana;background-color:cccccc;border-width:1;border-style:solid;border-color:black">
  67.         <tr>
  68.           <td style="padding:10,10,10,10" valign="top">
  69.             <table height="100%" style="font:10pt verdana;">
  70.               <tr>
  71.                 <td colspan="2"><b>Complete the following fields, then choose Next to continue:</b></td>
  72.               </tr>
  73.               <tr height="20"/>
  74.               <tr>
  75.                 <td>First Name:</td>
  76.                 <td><input id="FirstName" type="text" size="45" runat="server"></td>
  77.               </tr>
  78.               <tr>
  79.                 <td>Last Name:</td>
  80.                 <td><input id="LastName" type="text" size="45" runat="server"></td>
  81.               </tr>
  82.               <tr>
  83.                 <td colspan="2" align="right" height="100%" valign="bottom">
  84.                   <input type="submit" Value=" Next >> " OnServerClick="Next_Click" runat="server">
  85.                 </td>
  86.               </tr>
  87.             </table>
  88.           </td>
  89.         </tr>
  90.       </table>
  91.     </ASP:Panel>
  92.  
  93.     <ASP:Panel id="Panel1" Visible="false" runat="server">
  94.       <table width="500" height="200" style="font:10pt verdana;background-color:cccccc;border-width:1;border-style:solid;border-color:black">
  95.         <tr>
  96.           <td style="padding:10,10,10,10" valign="top">
  97.             <table height="100%" style="font:10pt verdana;">
  98.               <tr>
  99.                 <td colspan="2"><b>Complete the following fields, then choose Next to continue:</b></td>
  100.               </tr>
  101.               <tr height="20"/>
  102.               <tr>
  103.                 <td colspan="2">
  104.                   <Acme:Address id="Address" ShowCaption="false" runat="server"/>
  105.                 </td>
  106.               </tr>
  107.               <tr>
  108.                 <td colspan="2" align="right" valign="bottom" height="100%">
  109.                   <input type="submit" Value=" << Back " OnServerClick="Prev_Click" runat="server">
  110.                   <input type="submit" Value=" Next >> " OnServerClick="Next_Click" runat="server">
  111.                 </td>
  112.               </tr>
  113.             </table>
  114.           </td>
  115.         </tr>
  116.       </table>
  117.     </ASP:Panel>
  118.  
  119.     <ASP:Panel id="Panel2" Visible="false" runat="server">
  120.       <table width="500" height="200" style="font:10pt verdana;background-color:cccccc;border-width:1;border-style:solid;border-color:black">
  121.         <tr>
  122.           <td style="padding:10,10,10,10" valign="top">
  123.             <table height="100%" style="font:10pt verdana;">
  124.               <tr>
  125.                 <td colspan="2"><b>Complete the following fields, then choose Next to continue:</b></td>
  126.               </tr>
  127.               <tr height="20"/>
  128.               <tr>
  129.                 <td>Card Number: </td>
  130.                 <td><input id="CardNum" size="45" type="text" runat="server"/></td>
  131.               </tr>
  132.               <tr>
  133.                 <td>Card Type: </td>
  134.                 <td>
  135.                   <select id="CardType" runat="server">
  136.                     <option>Visa</option>
  137.                     <option>Mastercard</option>
  138.                     <option>Discover</option>
  139.                   </select>
  140.                 </td>
  141.               </tr>
  142.               <tr>
  143.                 <td>Expires: </td>
  144.                 <td><input id="Expires" type="text" runat="server"/></td>
  145.               </tr>
  146.               <tr>
  147.                 <td colspan="2" align="right" valign="bottom" height="100%">
  148.                   <input type="submit" Value=" << Back " OnServerClick="Prev_Click" runat="server">
  149.                   <input type="submit" Value="   Finish   " OnServerClick="Finish_Click" runat="server">
  150.                 </td>
  151.               </tr>
  152.             </table>
  153.           </td>
  154.         </tr>
  155.       </table>
  156.     </ASP:Panel>
  157.     </form>
  158.  
  159.     <asp:Label id="MyLabel" MaintainState="false" runat="server"/>
  160.  
  161.   </body>
  162. </html>
  163.  
  164.