开发者

Nested form elements on asp.net page

开发者 https://www.devze.com 2023-02-10 06:45 出处:网络
I have a <form runat=\"server\" name=\"aspnet_form\"...> and the code has option for th开发者_Python百科e user to enter another form

I have a <form runat="server" name="aspnet_form"...> and the code has option for th开发者_Python百科e 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?


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:

<form runat="server">
   <msdn:MyRegForm runat="server" id="userRegForm" 
    action="register.aspx" />
   <hr>
   <msdn:MyLogForm runat="server" id="userLogForm" 
    action="login.aspx" />
</form>

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号