两种形式的一页-可能吗? [英] Two Forms One Page - possible?

查看:105
本文介绍了两种形式的一页-可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的用户要求很简单:页面上有两个按钮,一个按钮在新窗口中显示PDF,另一个按钮在同一窗口中执行计算并显示结果.如果我设置

 Form.Target = " ; 在Page_Init中,将两个按钮的结果都放在一个新窗口中.如果我不理会它,它将它们放在同一窗口中.据我所知,我需要两种形式的目标,每个按钮一种,但是我所有的searchy-fu似乎都表明使用ASP.Net是不可能的. 

解决方案

不,ASP.NET只需要一个.如果添加另一个表单标签,它将没有viewstate.


就像克里斯蒂安所说,ASP.NET每页只允许一个表单标签.

但是,这需要重组您的网站和代码,您可以使用纯HTML或其他框架(例如MVC),该框架没有单一形式的限制.


My user''s requirement is simple: have two buttons on the page, one that displays a PDF in a new window, and another that performs a calculation and displays the result in the same window. If I set

Form.Target = "_blank";

in the Page_Init, it puts the results for both buttons in a new window. If I leave it alone, it puts both of them in the same window. As far as I can tell, I need two forms with separate targets, one for each button, but all my searchy-fu seems to indicate that this is not possible with ASP.Net. Has anyone done anything like this?

解决方案

No, ASP.NET requires only one. If you add another form tag, it won''t have viewstate.


Like Christian said, ASP.NET only allows for a single Form tag per page.

But, it would require restructing your site and code, you could use straight HTML or some other framework, like MVC, which doesn''t have the single form limit.


这篇关于两种形式的一页-可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆