views:

58

answers:

4
 Response.Write("<div><input type='submit' name='submit' value='Update Cart' /></div>")
 Response.Write("<div><input type='submit' name='submit' value='Shop More' /></div>")
 Response.Write("<div><input type='submit' name='submit' value='Checkout' /></div>")

that is some example code from my teacher, but he hasn't answered my email in a couple days so I need some help.

When you click the Update Cart button it just updates the cart page it's on, but when you click the Shop More button it links to Shop.aspx a different page, and the Checkout links to another page as well. I can't figure out how it is linking just from that code, anybody have any insights?

+1  A: 

Most likely either a server side redirect has occurred, or there is some Javascript which changed the form's action. Whether that was intentional or not is yet to be determined because the given code snippet doesn't give much to work with.

BalusC
+6  A: 

Matt:

Is that you? Look on page 75 of the text.. sorry about the delay.

--Your Teacher

John K
+1  A: 

By checking the value of Request.Form["submit"].ToString() you can perform a conditional operation.

BradBrening
A: 

You could also achieve the same effect with cross page posting in ASP.NET though that wouldn't match the source your teacher has given you.

Cross-Page Posting in ASP.NET Web Pages Link: http://msdn.microsoft.com/en-us/library/ms178139.aspx

Martin Smith