Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to submit 4 forms to 4 different pages

Status
Not open for further replies.

drew10

Programmer
Feb 26, 2002
123
US
I have a page that has 4 forms that submit to 4 different pages on 4 different web servers. In classic asp, this was easy. You just create 4 forms and point their action to the target pages, but in .net I have no idea how to accomplish this since pages post back to themselves. Anyone dealt with this problem before?

Thanks,
Drew
 
Four server forms on the same page? My understanding is that that won't work...

Is it working?

If they are just regularly flavored forms, then you can just set their action, and away you go... otherwise, you just redirect to the proper page in the various event handlers for each submit button of each form.

I'm still confused, though, on the 4 forms thing. MS says you cannot do that.

-paul
penny1.gif
penny1.gif

The answer to getting answered -- faq855-2992
 
There are numerous ways to do this. However, I choose to use the querystring as a way to pass my variables.

Your Form will be something like this:

<form id=&quot;Form1&quot; method=&quot;post&quot; runat=&quot;server&quot;>

<asp:textbox id=&quot;txtTextBox1&quot; runat=&quot;server&quot;></asp:textbox><br>

<asp:button id=&quot;cmdSubmit&quot; runat=&quot;server&quot; Text=&quot;Submit&quot;></asp:button>

</form>


When you click on the button, your code behind would do a response.redirect to whatever page you want to go to along with the variables you want to send placed into the querystring:

Private Sub cmdSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSubmit.Click

Response.Redirect(&quot;Page1.aspx?TB1=txtTextBox1.Text&quot;)

End Sub


This is just one programmer's way of doing it.
 
Thanks for the responses. My page allows the user to select from several payment methods, and I then post the account information to a payment service web page that expects a post. I'm pretty sure that just removing the runat=server and adding 4 forms will get the job done.

Thanks,
Drew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top