.ASPX中HTML代码:
<form id= "Form1 " method= "post " runat= "server ">
<div id= "Cz2 "> <input name= "Button1 " type= "button " value= "提交定单 "/> </div>
</form>
比如说我想单击确定之后提交到1.aspx去写入数据库表单的内容
这个按钮是HTML控件
应该加什么?
------解决方案--------------------------------------------------------
只要放一个按钮控件,然后设置跨页提交就可以了
------解决方案--------------------------------------------------------
用url参数
------解决方案--------------------------------------------------------
在现有ASP.NET的页面处理机制下,这样做似乎有些画蛇添足。如果是希望在客户端把信息发送到另一个页面进行隐式的处理,那么建议你使用XmlHttp来实现吧
------解决方案--------------------------------------------------------
什么都不用加,form改成 <form action= "1.aspx " ... >
然后用Request.Form[ "text "]可以得到值
------解决方案--------------------------------------------------------
<form id= "Form1 " method= "post " runat= "server " action= "1.aspx ">
<div id= "Cz2 "> <input name= "Button1 " type= "button " value= "提交定单 "/> </div>
</form>
在1.aspx中用request来获取你传递的值
------解决方案--------------------------------------------------------
<form id= "Form1 " method= "post " runat= "server " action= "1.aspx ">
<div id= "Cz2 "> <input name= "Button1 " type= "button " value= "提交定单 "/> </div>
</form>
======================
我在运行程序的时候点击提交按钮不起作用一点反应没有
----------------------》
<input name= "Button1 " type= "button "---》type= "submit "
------解决方案--------------------------------------------------------
<form id= "Form1 " method= "post " runat= "server " action= "1.aspx ">
<div id= "Cz2 "> <input name= "Button1 " type= "button " value= "提交定单 "/> </div>
</form>
================================================
不起作用是因为两点
1. <input name= "Button1 " type= "button "---》type= "submit "
2. <form id= "Form1 " method= "post " runat= "server " action= "1.aspx "> --> runat= "server "去掉
但这样何必要用ASP.NET呢
是否应该转换一下思路,用其他手段提交页面,比如url传值
------解决方案--------------------------------------------------------
那你这个页面就做成HTML静态页面就好了,何必用aspx呢
------解决方案--------------------------------------------------------
.ASPX中HTML代码:
<form id= "Form1 " method= "post " runat= "server ">
<div id= "Cz2 "> <input name= "Button1 " type= "button " value= "提交定单 " onclick= "window.location.href= '1.aspx?TEXT= '+this.value "/> </div>
</form>
1.aspx页面接收URL的参数TEXT的值
很好的方法
------解决方案--------------------------------------------------------
把runat=server去掉,把action的置设置为:action= "1.aspx "
然后就可以在1.aspx.cs中写Request.Form[ " "]