我想根据以前的表格将按钮链接到Web表单。 [英] I wan to link a button to the web form according to previous form.

查看:70
本文介绍了我想根据以前的表格将按钮链接到Web表单。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想根据以前的网络表单将按钮链接到网络表单。

例如,

我有3个网络表单

webform1, webform2,webform3,webform4。

i在webform3中有一个按钮。

点击webform3中的按钮后,

如果我以前的网页表格是webform1那么它应该重定向到webform4。

如果我之前的webform是webform2那么它应该重定向到webform5。

如何做到这一点有一个简单的方法。



我尝试了什么:



我想将一个按钮链接到网络根据以前的网络表格形式。

例如,

我有3个网络表格

webform1,webform2,webform3,webform4。

i在webform3中有一个按钮。

点击webform3中的按钮后,

如果我以前的网页表格是webform1那么它应该重定向到webform4。

如果我之前的webform是webform2,那么它应该重定向到webform5。

如何做到这一点有一个简单的方法。

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.

推荐答案

如果你只想从一个页面导航到另一个页面,你可以简单地使用Response.Redirect或Server.Transfer方法:



例如,在Button的Click事件中你可以这样做:



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:

Response.Redirect("Webform2.aspx");


取决于您如何定义上一个表单的内容。如果你单击webform1上的一个按钮,将你带到webform3,那么即使是webform1上的按钮,也会在会话中显示访问webform1的内容;



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";





然后您可以在webform3中检查该会话值以决定重定向到哪里。



you can then check that session value in webform3 to decide where to redirect to.


对于PHP(并且ASP.NET必须以某种方式允许相同),当从第一页表单打开页面时,我将沿着身份发送到页面,例如,表单中的隐藏字段。 PHP中的新页面将根据父页面发送的值构建,从而链接到创建时所需的任何内容。



重新表述,您启动表单的页面会导致新页面以自定义方式构建,并考虑它来自的页面。这是非常普遍的网络编程,所以你应该非常擅长它。
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.


这篇关于我想根据以前的表格将按钮链接到Web表单。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆