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

解决方案 »

  1.   

    use session variables, the data in the original Request will be still available if you use Server.Transfer, but this mean those pages have to be on a same server
      

  2.   

    But if use too many sessions, I am worried about performance.Is there some other ways?
      

  3.   

    “第一个页面一方面查询,一方面收集,一些数据,提交给第二页。第二页就是负责处理,并显示处理结果。”
    如果只想完成这样的处理,不如在第一个页面内就把数据处理完毕,存储到数据库,然后在第二页中显示即可。
    象您说的把第一页的内容传递到第二页,我现在用的也是session,还没有找到更好的方法。
    不过karma说to submit the form to another page, use (note, do not set runat=server)
    <form action=".." method="post"> 
    这点也是我没有想到的,到是可以试试。
      

  4.   

    真是奇怪的问题,难道都没人做过ASP???
    <%@ 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>
      

  5.   

    2. 在第一页面中有一些动作是要提交给它自己,但又有动作需要提交给第二页。
    use 
    <form runat=server>
    , after you process the form in 第一页面, use Server.Transfer to send to 第二页
    对这种情况倒底该如何处理,能不能更清楚地解释一下,(有例子吗?)
    我的下一个页面为查询页面,需传过去一个两个Value,
    谢谢!
      

  6.   

    readPassing Server Control Values Between Pages
    http://msdn.microsoft.com/library/en-us/cpguide/html/cpconpassingservercontrolvaluesbetweenpages.asp?frame=true
      

  7.   

    其实有一个很简单的办法,你只要在你的第一页里面包含一个自定义控件就可以了。它可以同父页面共享Request和Response对象。
      

  8.   

    一个RunAtServer的Form只能提交给自己。在页面被解释的是否,.NET会自动把这个Form的action指向自己,而不管在设计的时候有没有为这个Form指定action页面。
    也就是说,如果要提交到别的页面,那就不能用RunAtServer的Form。而且这样的Form也不能包含服务器端的控件,这样也就和ASP的东西一样了。
      

  9.   

    其实在客户端的事件中也可以强行改掉form的action
    只是处理的页面的视图需要好好处理
    否则是通不过的
    嗯,应该要override一个跟ViewState有关的方法
    object LoadPageStateFromPersistenceMedium()
    当不是处理本页面的时候要return null