Connecting Tech Pros Worldwide Help | Site Map

How to include multiple <forms> on one ASP.NET page

  #1  
Old November 17th, 2005, 07:40 PM
Ben Turner
Guest
 
Posts: n/a
Hi,

I need to create an ASPX page that includes both traditional HTML Forms
(which are submitted to a third-party site like a travel booking service)
and also make use of the ASP.Net form. I've tried a number of approaches so
far but none seem to really suffice:

1. Position the HTML form elements absolutely and simply write the HTML
after the </form> tag. This sort of works but then allows no server control
over the creation of the form (i.e. setting the check-in date as today + 7)
as all of the elements lack the 'runat=server' parameter.

2. Make the HTML form submit to my IIS server and then simply prepare
redirect to a URL with all of the form elements included (i.e. mimic a
method=get form). This works (in some cases) but creates the most hideous
URL's (and obviously is limited in length etc. etc. etc.)

3. Submit the HTML form to my IIS server and then construct a POST query by
hand. I'm not even sure if this is allowed, and seems like a nasty approach
as it will involve unnecessary extra visits to my server.

What I'd really like to do is have the secondary form as a custom Web
Control so that it can be prepared at the server, customised according to
dates etc. and then served to whichever page needs it. When the user clicks
'submit' it would (preferably) submit directly to the third-party site.

Does anyone have any ideas?

Thanks in advance!

Ben.

mailto:ben@guidetotheworld.net


  #2  
Old November 17th, 2005, 07:40 PM
Ram
Guest
 
Posts: n/a

re: How to include multiple <forms> on one ASP.NET page


If you are submitting the form using a button named Button1, you can
add the following code to Page Load event to submit your form directly
to Hotmail site.

Button1.Attributes.Add("onClick",
"Form1.action='http://www.hotmail.com';Form1.Submit;")

You don't need to create a custom control to submit a server form to a
third party site.

Thanks
Ram


"Ben Turner" <ben@guidetotheworld.net> wrote in message news:<Tu2Wa.2272$bo1.1409@news-server.bigpond.net.au>...[color=blue]
> Hi,
>
> I need to create an ASPX page that includes both traditional HTML Forms
> (which are submitted to a third-party site like a travel booking service)
> and also make use of the ASP.Net form. I've tried a number of approaches so
> far but none seem to really suffice:
>
> 1. Position the HTML form elements absolutely and simply write the HTML
> after the </form> tag. This sort of works but then allows no server control
> over the creation of the form (i.e. setting the check-in date as today + 7)
> as all of the elements lack the 'runat=server' parameter.
>
> 2. Make the HTML form submit to my IIS server and then simply prepare
> redirect to a URL with all of the form elements included (i.e. mimic a
> method=get form). This works (in some cases) but creates the most hideous
> URL's (and obviously is limited in length etc. etc. etc.)
>
> 3. Submit the HTML form to my IIS server and then construct a POST query by
> hand. I'm not even sure if this is allowed, and seems like a nasty approach
> as it will involve unnecessary extra visits to my server.
>
> What I'd really like to do is have the secondary form as a custom Web
> Control so that it can be prepared at the server, customised according to
> dates etc. and then served to whichever page needs it. When the user clicks
> 'submit' it would (preferably) submit directly to the third-party site.
>
> Does anyone have any ideas?
>
> Thanks in advance!
>
> Ben.
>
> mailto:ben@guidetotheworld.net[/color]
  #3  
Old November 17th, 2005, 07:41 PM
Saravana
Guest
 
Posts: n/a

re: How to include multiple <forms> on one ASP.NET page


You can check out this article, it might help you
http://msdn.microsoft.com/msdnmag/is...5/CuttingEdge/


--
Saravana
Microsoft India Community Star,MC**
www.ExtremeExperts.com



"Ben Turner" <ben@guidetotheworld.net> wrote in message
news:Tu2Wa.2272$bo1.1409@news-server.bigpond.net.au...[color=blue]
> Hi,
>
> I need to create an ASPX page that includes both traditional HTML Forms
> (which are submitted to a third-party site like a travel booking service)
> and also make use of the ASP.Net form. I've tried a number of approaches[/color]
so[color=blue]
> far but none seem to really suffice:
>
> 1. Position the HTML form elements absolutely and simply write the HTML
> after the </form> tag. This sort of works but then allows no server[/color]
control[color=blue]
> over the creation of the form (i.e. setting the check-in date as today +[/color]
7)[color=blue]
> as all of the elements lack the 'runat=server' parameter.
>
> 2. Make the HTML form submit to my IIS server and then simply prepare
> redirect to a URL with all of the form elements included (i.e. mimic a
> method=get form). This works (in some cases) but creates the most hideous
> URL's (and obviously is limited in length etc. etc. etc.)
>
> 3. Submit the HTML form to my IIS server and then construct a POST query[/color]
by[color=blue]
> hand. I'm not even sure if this is allowed, and seems like a nasty[/color]
approach[color=blue]
> as it will involve unnecessary extra visits to my server.
>
> What I'd really like to do is have the secondary form as a custom Web
> Control so that it can be prepared at the server, customised according to
> dates etc. and then served to whichever page needs it. When the user[/color]
clicks[color=blue]
> 'submit' it would (preferably) submit directly to the third-party site.
>
> Does anyone have any ideas?
>
> Thanks in advance!
>
> Ben.
>
> mailto:ben@guidetotheworld.net
>
>[/color]


Closed Thread