Link to home
Start Free TrialLog in
Avatar of WaldaInc
WaldaInc

asked on

How to get an ASP.NET 2.0 Content Form to submit to a third party web page

Hello

I'm a web app that uses Master pages.  Most of the pages use nested master pages. With master pages you must have a <form> tag with a runat=server attribute.  This causes the page to just post back to itself, works great.

However, I have 1 page in the whole site that needs to post to a third party page, and that page will read some of the controls I have on my page, then auto register someone (one of the fields is an email).

The issue I am having is how do I get the form to post to the third part page.

I've tried this on the Master Page:

<form id="Form1" method="post" runat="server" onsubmit="document.Form1.action='WebForm2.aspx';">

However, that gives me an error on the Form1 part as .NET gives the form some weird ID of aspnetForm. I tried chaning the Form1 part to that, but the page just hangs and does nothing.

I also tried this on the the onClick fo the submit button:

       function valSubmit()  
        {
            alert("Hello");
            var doc = document.forms[0];
            doc.submit();
        }

I see the Hello alert box, but the form still posts back to itself.

Can I do this? I really want the web page to have the same look and feel (thus the Master pages), but it just doesn't seem to work.  if I remove the master pages, it works, but then the Look and Feel looks crappy.

Thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of David H.H.Lee
David H.H.Lee
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of WaldaInc
WaldaInc

ASKER

Yep, I found that out too (page 5 of the Google search). Thanks for posting this, was going to close it tomorrow moring.