0

我很困惑...我的 aspx 页面上有一个表单,文本字段位于更新面板内。我用它来验证登录。如果登录成功,我更改表单操作,然后我希望表单提交到该 url。

<form runat="server" id="form1">
     <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
     <asp:UpdatePanel ID="UpdatePanel1" runat="server">
          <ContentTemplate>
               <!--form fields-->
               <asp:Button ID="btnSubmit" runat="server"  onclick="btnSubmit_click" Text="Continue" />
          </ContentTemplate>
     </asp:UpdatePanel>
</form>

然后我的代码隐藏

 protected void btnSubmit_click(object sender, EventArgs e)
 {
      //do some validation, if ok then change the form action
      form1.Action = "myurl2.aspx";
      btnSubmit = "proceed to next url";
 }

因此,一旦用户通过验证,我将更改要发布到的表单的 URL,然后更改按钮名称。当我然后单击提交按钮时,没有任何反应。如何提交表格?我尝试做类似 form1.submit 的事情,但显然不存在!

4

1 回答 1

0

试着打电话

Server.Transfer(...);

或者

Response.Redirect(...);
于 2012-11-16T12:54:48.627 回答