470,631 Members | 1,621 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,631 developers. It's quick & easy.

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:be*@guidetotheworld.net
Nov 17 '05 #1
2 19426
Ram
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" <be*@guidetotheworld.net> wrote in message news:<Tu*****************@news-server.bigpond.net.au>...
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:be*@guidetotheworld.net

Nov 17 '05 #2
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" <be*@guidetotheworld.net> wrote in message
news:Tu*****************@news-server.bigpond.net.au...
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:be*@guidetotheworld.net

Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

61 posts views Thread by Toby Austin | last post: by
4 posts views Thread by headware | last post: by
2 posts views Thread by James X. Li | last post: by
3 posts views Thread by Saket Mundra | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.