asp.net 页面上的嵌套表单元素
我有一个
在不使用 IFrame 的情况下如何解决此问题?
I have a <form runat="server" name="aspnet_form"...>
and the code has option for the user to enter another form<form action="test.asp" method="post">
using html editor. But the problem arises due to nested forms.
How can I resolve this issue without using IFrame?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一种可能的解决方法是创建逻辑上与表单等效的服务器组件。此类组件全部包含在单个服务器端表单中,但为您提供了允许它们收集某些输入数据并将其提交到外部页面的功能子集。创建此类可嵌入组件的最简单方法是通过用户控件。
这个想法是为需要显示的每个逻辑表单创建一个用户控件。页面的最终结构如下所示:
除了管理子控件之外,用户控件还提供一组基本功能,例如 Action 属性。
您可以在此处查看如何处理此问题的更高级示例。
A possible workaround entails the creation of server components that are logically equivalent to forms. Such components are all contained within a single server-side form, but provide you with the subset of functionality that allows them to gather and submit some input data to an external page. The simplest way to create such embeddable components is through user controls.
The idea is that you create a user control for each logical form you need to display. The final structure of the page looks like this:
In addition to managing child controls, the user controls also provide a basic set of features, such as the Action property.
You can see more advanced example how to deal with this issue here.