今天的问题是,关于在asp.net的环境下提交表单。我和asp一样编写了一个按钮触发的事件,然后使用formname.submit来进行submit。结果提示:
bc30451: name form1 is not declared.
但我在后面的表单里明明是定义了啊,源代码如下:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>index</title>
<script language="vb" runat="server">
sub bt_submit(sender as object,e as eventargs)
form1.submit
end sub
sub bt_cancel(sender as object,e as eventargs)
txt.text=""
txtpwd.text=""
txtpwd2.text=""
txtemail.text=""
end sub
</script>
</head>
<body>
<center>
<form name="form1" method="post" action="check.aspx" runat="server">
<table width="533" border="1">
<tr>
<th width="220" scope="row"><div align="right">id:</div></th>
<td width="297"><asp:textbox id="txtid" runat="server" />
</td>
</tr>
<tr>
<th scope="row"><div align="right">password:</div></th>
<td><asp:textbox id="txtpwd1" textmode="password" runat="server" text=12345678 />
</td>
</tr>
<tr>
<th scope="row"><div align="right">input password again:</div></th>
<td><asp:textbox id="txtpwd2" textmode="password" runat="server" text=12345678 />
</td>
</tr>
<tr>
<th scope="row"><div align="right">sex:</div></th>
<td><asp:radiobuttonlist id="radiobuttonlist" runat="server">
<asp:listitem value="1">men</asp:listitem>
<asp:listitem value="2">female</asp:listitem>
</asp:radiobuttonlist>
</td>
</tr>
<tr>
<th scope="row"><div align="right">e-mail:</div></th>
<td><asp:textbox id="txtemail" runat="server" />
</td>
</tr>
<tr>
<th colspan="2" scope="row"><div align="center">
<asp:button id="btsubmit" runat="server"
text="submit"
borderstyle="ridge"
backcolor="lightblue"
onmouseover="this.style.backgroundcolor=ff3366"
onmouseout="this.style.backgroundcolor=lightblue" />
<asp:button id="btcancel" runat="server"
text="cancel"
borderstyle="ridge"
backcolor="lightblue"
onmouseover="this.style.backgroundcolor=ff3366"
onmouseout="this.style.backgroundcolor=lightblue" />
</div></th>
</tr>
</table>
</form>
</center>
</body>
</html>
看来asp和asp.net之间真的是有太多的不同了,这样一来一回真是晕死。还得继续请教高人。毕竟——asp.net才是偶未来的方向,一定要很熟练的掌握!
