frosty
frosty

Reputation: 5370

Override asp.net form tag

I have master page that contains the following asp.net form tag

<form id="CommerceMasterForm" runat="server">

on one page of my website i need to create normal html form from a user control

<FORM action="http://externaldomain.com" method="post">

How can i override the asp.net form tag and make it post like a typical html form.

Upvotes: 2

Views: 905

Answers (2)

Rex M
Rex M

Reputation: 144142

You can use Cross Page Posting to have the existing form submit to another page:

<asp:Button runat="server" id="Submit" PostBackUrl="TargetPage.aspx" />

From MSDN:

Under some circumstances, you might want to post one page to another page. ... In that case, you can configure certain controls on the page to post to a different target page. This is referred to as cross-page posting.

Because cross-page posting is configured for individual controls, you can create a page that posts to different pages depending on which button the user clicks.

Upvotes: 3

Gordon Bell
Gordon Bell

Reputation: 13633

You should be able to include a close form tag before your new form tag. Multiple Form Tags are allowed in HTML, but they can't be nested. I use this trick with PayPal in some MasterPages and it works okay.

</FORM>
<FORM action="http://externaldomain.com" method="post">

This will prevent postback of any server controls from that point on though.

Upvotes: 3

Related Questions