Connecting Tech Pros Worldwide Help | Site Map

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

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 17th, 2005, 06:40 PM
Ben Turner
Guest
 
Posts: n/a
Default How to include multiple <forms> on one ASP.NET page

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, 06:40 PM
Ram
Guest
 
Posts: n/a
Default 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, 06:41 PM
Saravana
Guest
 
Posts: n/a
Default 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]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.