ASP.NET: Web Form Controls e gli eventi – Codice sorgente dell’esempio

Sorgenti: TextBox.aspx

Scarica i sorgenti: aspnet05.zip

Articolo a cui si riferisce il codice: ASP.NET: Web Form Controls e gli eventi

TextBox.aspx – Prova l’esempio [nuova finestra]

  1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3 
  4 <%@Page Language="VB"%>
  5 <%@Register TagPrefix="ANet" TagName="Footer" Src="includes/footer.ascx"%>
  6 
  7 <!
  8 # nome: TextBox.aspx
  9 # scritto da: Antonio Volpon
 10 # data creazione: 25 Ottobre 2001
 11 # ultima modifica: 25 Ottobre 2001
 12 # copyright: Antonio Volpon
 13 >
 14 
 15 <script language="vb" runat="server">
 16   sub txtTextBox_Changed(sender as Object, e as EventArgs)
 17     risposta.InnerHtml +="E’ cambiato il valore di " + sender.ID + "<br />"
 18   end sub
 19 </script>
 20 
 21 <html>
 22   <head>
 23     <link rel="stylesheet" href="css/aspnet.css" type="text/css">
 24     </link>
 25     <title>I Web Form Controls: TextBox</title>
 26   </head>
 27   <body>
 28     <div class="titolo">
 29       I Web Form Controls: TextBox
 30     </div>
 31     
 32     <hr noshade="noshade" size="1" width="100%">
 33     
 34     
 35     <form runat="server">
 36     
 37     <table border="1" cellpadding="5" cellspacing="0" bordercolor="#999999" align="center">
 38       <tr>
 39         <td>Primo TextBox</td>
 40         <td>
 41  <asp:TextBox runat="server"
 42  id="txtTextBox1"
 43  Text="Primo TextBox"
 44  BackColor="#99ccff"
 45  TextMode="MultiLine"
 46  Rows="5"
 47  OnTextChanged="txtTextBox_Changed" />

 48         </td>
 49       </tr>
 50       <tr>
 51         <td>Secondo TextBox</td>
 52         <td>
 53  <asp:TextBox runat="server"
 54  id="txtTextBox2"
 55  Text="Secondo TextBox"
 56  TextMode="SingleLine"
 57  AutoPostBack="true"
 58  OnTextChanged="txtTextBox_Changed"/>

 59         </td>
 60       </tr>
 61       <tr>
 62         <td>Terzo TextBox</td>
 63         <td>
 64  <asp:TextBox runat="server"
 65  id="txtTextBox3"
 66  TextMode="Password"/>

 67         </td>
 68       </tr>
 69       <tr>
 70         <td>Quarto TextBox</td>
 71         <td>
 72  <asp:TextBox runat="server"
 73  id="txtTextBox4"
 74  TextMode="MultiLine"
 75  ScrollBars="Both"
 76  Wrap="false"
 77  ReadOnly="true" />

 78         </td>
 79       </tr>
 80       <tr>
 81         <td colspan="2"><input type="submit" value="Invia" alt="invia"></td>
 82       </tr>
 83     </table>
 84     
 85     </form>
 86 
 87  <div id="risposta" class="risposta" runat="server" EnableViewState="false"></div>
 88 
 89  <ANet:Footer id="Menu" runat="server" />
 90     
 91   </body>
 92 </html>