Click here to Skip to main content
15,890,947 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to link a button to web form according to previous webform.
For example,
Iam having 3 webforms
webform1, webform2, webform3, webform4.
i have a button in webform3.
After clicking button in webform3,
if my previous web form is webform1 then it should redirect to webform4.
if my previous webform is webform2 then it should redirect to webform5.
how to do it is there a a simple way to do it.

What I have tried:

I want to link a button to web form according to previous webform.
For example,
Iam having 3 webforms
webform1, webform2, webform3, webform4.
i have a button in webform3.
After clicking button in webform3,
if my previous web form is webform1 then it should redirect to webform4.
if my previous webform is webform2 then it should redirect to webform5.
how to do it is there a a simple way to do it.
Posted
Updated 24-Oct-18 5:51am

If you want just to navigate from one page to another, you can simply use the Response.Redirect or Server.Transfer methods:

For example, in your Button's Click event you could do:

C#
Response.Redirect("Webform2.aspx");
 
Share this answer
 
Depends how you define what the "previous form" is. If you click a button on webform1 that takes you to webform3 then in the click even for the button on webform1 store something in the session that says webform1 was accessed;

Session["LastForm"] = "webform1";


you can then check that session value in webform3 to decide where to redirect to.
 
Share this answer
 
For PHP (and ASP.NET must allow the same in some way), when the page is opened from the first page form I'd send along the identity to the page, in, for example, a hidden field within the form. The new page, in PHP, would be built based upon the value sent by the parent page and thus link to whatever you want when it is created.

Rephrased, the page you start form causes the new page to be built in a custom manner that takes into consideration the page it comes from. This is pretty ubiquitou web programming, so you should get really good at it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900