【问题标题】:How to submit the form via post and open the target page in an iframe如何通过 post 提交表单并在 iframe 中打开目标页面
【发布时间】:2011-09-29 20:44:20
【问题描述】:

我有一个表单,它在发布后重定向到新页面 index.aspx。但是,我不想在新窗口中打开新页面,而是将其作为 iframe 打开,以便它保留在当前窗口中

我该怎么做。当前代码是:

     <form id="Form2" action="index.aspx" method="post" name="Form2" >
.....

<input type="image" style="border-width: 0px;" src="images/form_ordernow_btn.jpg"
                tabindex="129" id="Form1_ImageButton1" name="Form1$ImageButton1"  >

顺便说一下,我正在使用asp.net

【问题讨论】:

  • 哦,我应该更清楚。我希望目标页面,即 index.aspx 在回发时在 iframe 中打开
  • 您能否详细说明一下,为什么需要这样?也许还有另一种观点?
  • 那么要求是表单包含账单信息,点击提交按钮后,理想情况下应该在灯箱中打开此索引页面,并且索引页面应填充此表单中的信息。但是 U真的很难将数据发布到灯箱,所以尝试这种方法一点也不优雅。

标签: asp.net forms iframe


【解决方案1】:

已经将表单放入 iframe 中。所以回发将在同一个 iframe 中打开...

@Edit:如果表单必须在同一页面上但不能在发布时在 iframe 中,则以下解决方案可能有效:

  • 回发到同一个(!)页面
  • 将 iframe 插入服务器上的页面中
  • 根据postdata给iframe一个url 即更改 POST -> GET 数据
  • 以这种方式构造目标页面 (index.aspx) 以处理 GET 参数

【讨论】:

    猜你喜欢
    • 2011-06-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-18
    • 2012-03-10
    • 1970-01-01
    • 1970-01-01
    • 2013-08-27
    相关资源
    最近更新 更多