如:    <form id="form1" runat="server" action="../Member/Order/OrderCheck.aspx" method="post">
        <asp:TextBox ID="TextBox1" runat="server" name="text_name"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" Text="Button" />
    </form>
TextBox1的值能在OrderCheck.aspx页面获取到吗?急。谢谢

解决方案 »

  1.   

    如果是button激活postback的话,可以使用button的PostBackUrl属性。例如<asp:button id="Button2"
          text="Post value to another page" 
          postbackurl="Button.PostBackUrlPage2cs.aspx" 
          runat="Server">
        </asp:button>在Button.PostBackUrlPage2cs.aspx页面的Page_Load中使用PreviousPage来取得前面页面上控件的值 void Page_Load (object sender, System.EventArgs e)
      {
        string text;    // Get the value of TextBox1 from the page that 
        // posted to this page.
        text = ((TextBox)PreviousPage.FindControl("TextBox1")).Text;    // Check for an empty string.
        if (text != "")
          PostedLabel.Text = "The string posted from the previous page is "
                             + text + ".";
        else
          PostedLabel.Text = "An empty string was posted from the previous page.";
      }参考:
    http://msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.button.postbackurl.aspx
      

  2.   

    只要你在客户端看到了目标action的话,就可以。就怕你看不到,默认地asp.net会去修改Action。
      

  3.   

    对于为按钮执行PostBackUrl而言,设计时应该采取面向功能接口的方式,类似于这样的方式使用它var p= (IMyLastPage)PreviousPage;
    var s= p.PostText;     //接口IMyLastPage中定义的一个属性这样你想用来采集输入的控件不一定放在哪里(比如是在某个容器控件中),也不一定使用TextBox控件。