1. to submit the form to another page, use (note, do not set runat=server)
<form action=".." method="post"> 2. 在第一页面中有一些动作是要提交给它自己,但又有动作需要提交给第二页。
use
<form runat=server>
, after you process the form in 第一页面, use Server.Transfer to send to 第二页3. in global.asax, just like what you do in ASP/global.asa, use Application/Session, for details, read:Using the Global.asax File
http://samples.gotdotnet.com/quickstart/aspplus/doc/globalasax.aspx
<form action=".." method="post"> 2. 在第一页面中有一些动作是要提交给它自己,但又有动作需要提交给第二页。
use
<form runat=server>
, after you process the form in 第一页面, use Server.Transfer to send to 第二页3. in global.asax, just like what you do in ASP/global.asa, use Application/Session, for details, read:Using the Global.asax File
http://samples.gotdotnet.com/quickstart/aspplus/doc/globalasax.aspx
如果只想完成这样的处理,不如在第一个页面内就把数据处理完毕,存储到数据库,然后在第二页中显示即可。
象您说的把第一页的内容传递到第二页,我现在用的也是session,还没有找到更好的方法。
不过karma说to submit the form to another page, use (note, do not set runat=server)
<form action=".." method="post">
这点也是我没有想到的,到是可以试试。
<%@ Page Language="vb" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<html>
<body>
<form action="insert.aspx" method="post" id="A">
<table id="table1" width="80%" border=1 runat="server"/>
<input type=submit value="Submit">
</form>
<asp:label id="Message" runat="server" />
</body>
</html>
<script language="vb" runat=server>
sub page_load(sender as object,e as eventargs)
dim rw as htmltablerow
dim cl as htmltablecell
dim i as integer
dim j as integer
dim textbox as textbox
rw=new htmltablerow
for i=0 to 3
cl=new htmltablecell
textbox=new textbox()
textbox.id="text" & j & i
cl.controls.add(textbox)
rw.cells.add(cl)
next i
table1.rows.add(rw)
end sub
</script>
<%@ Page Language="vb" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<html>
<body>
<asp:label id="Message" runat="server" />
</body>
</html>
<script language="vb" runat=server>
sub page_load(sender as object,e as eventargs)
dim i as integer
dim j as integer
dim strSQL as string
strSQL="insert table1 values("
for i=0 to 3
strSQL=strSQL & "'" & Request.Form("text" & j & i) & "',"
next
if strSQL.Substring(strSQL.length-1,1)="," then
strSQL=strSQL.Substring(0,strSQL.length-1)
end if
strSQL=strSQL & ")"
Message.Text=strSQL
Dim cn As New SqlConnection("server=TESTINGDC;database=pubs;User ID=sa")
Dim sqlCmd As New SQLCommand(strSQL,cn)
cn.Open()
sqlCmd.ExecuteNonQuery()
cn.Close()
end sub
</script>
use
<form runat=server>
, after you process the form in 第一页面, use Server.Transfer to send to 第二页
对这种情况倒底该如何处理,能不能更清楚地解释一下,(有例子吗?)
我的下一个页面为查询页面,需传过去一个两个Value,
谢谢!
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconpassingservercontrolvaluesbetweenpages.asp?frame=true
也就是说,如果要提交到别的页面,那就不能用RunAtServer的Form。而且这样的Form也不能包含服务器端的控件,这样也就和ASP的东西一样了。
只是处理的页面的视图需要好好处理
否则是通不过的
嗯,应该要override一个跟ViewState有关的方法
object LoadPageStateFromPersistenceMedium()
当不是处理本页面的时候要return null