| <!--源文件:form\web页面简介\page1.aspx--> <HTML> <BODY> <SCRIPT language="VB" runat="server"> Sub ShowValues(Sender As Object, Args As EventArgs) divResult.innerText = "You selected '" _ & selOpSys.value & "' for machine '" _ & txtName.value & "'." End Sub </SCRIPT> <DIV id="divResult" runat="server"> </DIV> <FORM runat="server"> 机器名: <INPUT type="text" id="txtName" runat="server"> <P /> 操作系统: <select id="selOpSys" size="1" runat="server"> <OPTION>Windows 95</OPTION> <OPTION>Windows 98</OPTION> <OPTION>Windows NT4</OPTION> <OPTION>Windows 2000</OPTION> </SELECT> <P /> <INPUT type="submit" value="Submit" runat="server" onserverclick="ShowValues"> </FORM> </BODY> </HTML> |
| <HTML> <BODY> You selected 'Windows 98' for machine 'iceberg'. <FORM name="ctrl0" method="post" action="pageone.aspx" id="ctrl0"> <INPUT type="hidden" name="__VIEWSTATE" value="a0z1741688109__x"> 机器名: <INPUT type="text" id="txtName" name="txtName" value="tizzy"> <P /> 操作系统: <SELECT id="selOpSys" size="1" name="selOpSys"> <OPTION value="Windows 95">Windows 95</OPTION> <OPTION selected value="Windows 98">Windows 98</OPTION> <OPTION value="Windows NT4">Windows NT4</OPTION> <OPTION value="Windows 2000">Windows 2000</OPTION> </SELECT> <P /> <INPUT type="submit" value="Submit"> </FORM> </BODY> </HTML> |
| If Len(Request.Form("selOpSys")) > 0 Then StrOpSys = Request.Form("selOpSys") StrName = Request.Form("txtName") Response.Write("You selected '" & strOpSys _ & "' for machine '" & strName & "'.") End If |
| If Len(selOpSys.value) > 0 Then Response.Write("You selected '" & selOpSys.value _ & "' for machine '" & txtName.value & "'.") End If |
<!--源文件:form\ServerControl\summary.aspx--> <%@ Page clienttarget=downlevel %> <html> <head> <script language="VB" runat="server"> Sub ListFormat_SelectedIndexChanged(sender As Object, e As EventArgs) ' Change display mode of the validator summary when a new option ' is selected from the "ListFormat" dropdownlist valSum.DisplayMode = ListFormat.SelectedIndex End Sub </script> </head> <BODY> <h3><font face="Verdana">ValidationSummary Sample</font></h3> <p> <form runat="server"> <table cellpadding=10> <tr> <td> <table bgcolor="#eeeeee" cellpadding=10> <tr> <td colspan=3> <font face=Verdana size=2><b>Credit Card Information</b></font> </td> </tr> <tr> <td align=right> <font face=Verdana size=2>Card Type:</font> </td> <td> <ASP:RadioButtonList id=RadioButtonList1 RepeatLayout="Flow" runat=server> <asp:ListItem>MasterCard</asp:ListItem> <asp:ListItem>Visa</asp:ListItem> </ASP:RadioButtonList> </td> <td align=middle rowspan=1> <asp:RequiredFieldValidator id="RequiredFieldValidator1" ControlToValidate="RadioButtonList1" ErrorMessage="Card Type. " Display="Static" InitialValue="" Width="100%" runat=server> * </asp:RequiredFieldValidator> </td> </tr> <tr> <td align=right> <font face=Verdana size=2>Card Number:</font> </td> <td> <ASP:TextBox id=TextBox1 runat=server /> </td> <td> <asp:RequiredFieldValidator id="RequiredFieldValidator2" ControlToValidate="TextBox1" ErrorMessage="Card Number. " Display="Static" Width="100%" runat=server> * </asp:RequiredFieldValidator> </td> </tr> <tr> <td align=right> <font face=Verdana size=2>Expiration Date:</font> </td> <td> <ASP:DropDownList id=DropDownList1 runat=server> <asp:ListItem></asp:ListItem> <asp:ListItem >06/00</asp:ListItem> <asp:ListItem >07/00</asp:ListItem> <asp:ListItem >08/00</asp:ListItem> <asp:ListItem >09/00</asp:ListItem> <asp:ListItem >10/00</asp:ListItem> <asp:ListItem >11/00</asp:ListItem> <asp:ListItem >01/01</asp:ListItem> <asp:ListItem >02/01</asp:ListItem> <asp:ListItem >03/01</asp:ListItem> <asp:ListItem >04/01</asp:ListItem> <asp:ListItem >05/01</asp:ListItem> <asp:ListItem >06/01</asp:ListItem> <asp:ListItem >07/01</asp:ListItem> <asp:ListItem >08/01</asp:ListItem> <asp:ListItem >09/01</asp:ListItem> <asp:ListItem >10/01</asp:ListItem> <asp:ListItem >11/01</asp:ListItem> <asp:ListItem >12/01</asp:ListItem> </ASP:DropDownList> </td> <td> <asp:RequiredFieldValidator id="RequiredFieldValidator3" ControlToValidate="DropDownList1" ErrorMessage="Expiration Date. " Display="Static" InitialValue="" Width="100%" runat=server> * </asp:RequiredFieldValidator> </td> <td> </tr> <tr> <td></td> <td> <ASP:Button id=Button1 text="有效性验证" runat=server /> </td> <td></td> </tr> </table> </td> <td valign=top> <table cellpadding=20><tr><td> <asp:ValidationSummary ID="valSum" runat="server" HeaderText="You must enter a value in the following fields:" Font-Name="verdana" Font-Size="12" /> </td></tr></table> </td> </tr> </table> <font face="verdana" size="-1">Select the type of validation summary display you wish: </font> <asp:DropDownList id="ListFormat" AutoPostBack=true OnSelectedIndexChanged="ListFormat_SelectedIndexChanged" runat=server > <asp:ListItem>List</asp:ListItem> <asp:ListItem selected>Bulleted List</asp:ListItem> <asp:ListItem>Single Paragraph</asp:ListItem> </asp:DropDownList> </form> </body> </html> |
| <p> 行: <select id="Select1" runat="server"> <option Value="1">1</option> <option Value="2">2</option> <option Value="3">3</option> <option Value="4">4</option> </select> <br> 列: <select id="Select2" runat="server"> <option Value="1">1</option> <option Value="2">2</option> <option Value="3">3</option> <option Value="4">4</option> </select> 在用户提交的时候,实际上我们示对页面进行了刷新,即在Page_Load方法里面处理,具体如下(htmltable.aspx): <!--源文件: form\HtmlControl\htmltable.aspx--> <html> <head> <script language="VB" runat="server"> Sub Page_Load(sender As Object, e As EventArgs) Dim numrows As Integer Dim numcells As Integer Dim i As Integer = 0 Dim j As Integer = 0 Dim Row As Integer = 0 Dim r As HtmlTableRow Dim c As HtmlTableCell ' 产生表格 numrows = CInt(Select1.Value) numcells = CInt(Select2.Value) For j = 0 To numrows-1 r = new HtmlTableRow() If (row Mod 2 <> 0) Then r.BgColor = "Gainsboro" End If row += 1 For i = 0 To numcells-1 c = new HtmlTableCell() c.Controls.Add(new LiteralControl("row " & j & ", cell " & i)) r.Cells.Add(c) Next i Table1.Rows.Add(r) Next j End Sub </script> </head> <body> <h3><font face="Verdana">.NET->HtmlTable</font></h3> <form runat=server> <font face="Verdana" size="-1"> <p> <table id="Table1" CellPadding=4 CellSpacing=0 Border="1" runat="server" /> <p> 行: <select id="Select1" runat="server"> <option Value="1">1</option> <option Value="2">2</option> <option Value="3">3</option> <option Value="4">4</option> </select> <br> 列: <select id="Select2" runat="server"> <option Value="1">1</option> <option Value="2">2</option> <option Value="3">3</option> <option Value="4">4</option> </select> <input type="submit" value="产生表格" runat="server"> </font> </form> </body> </html> |
| 共分1页 [1] |
关于网站 | 客服中心 | 服务条款 | 友情链接 | 广告联系 | 本站历程 | 网站导航
吉ICP备05000107号