Html 从一个页面获取文本框值到另一页文本框值

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8552980/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 12:04:19  来源:igfitidea点击:

Getting textbox value from one page to another page textbox value

asp.nethtmlforms

提问by HymanyBoi

I am creating a form in my website and i link this form to the google docs (FORM which i created there). But this new form that i am trying to do is this in such a way that a textbox value from the first page should be passed over to the next page lets say page2 textbox value

我正在我的网站上创建一个表单,并将此表单链接到 google 文档(我在那里创建的表单)。但是我尝试做的这个新表单是这样一种方式,即第一页的文本框值应该传递到下一页让我们说 page2 文本框值

CODE IS ROUGHLY SOMETHING LIKE THIS
PAGE 1.html,aspx,asp (Watever) "/>

代码大致类似于此
页面 1.html,aspx,asp (Watever)"/>

Page2.html,aspx,asp (Watever) **readonly**"/>

Page2.html,aspx,asp (Watever) **只读**"/>

So since i am using the google docs to save my data
** form action="http://docs.google.com
i am unsure how to pass these values, tks for the help.

因此,由于我使用 google docs 来保存我的数据
** form action="http://docs.google.com
我不确定如何传递这些值,tks 寻求帮助。

Presently i am just getting the values from page1 to page2 using this microsoft tutorial http://support.microsoft.com/kb/300104

目前我只是使用这个微软教程http://support.microsoft.com/kb/300104获取从 page1 到 page2 的值

回答by BizApps

I think you need to read

我认为你需要阅读

How to: Pass Values Between ASP.NET Web Pages

如何:在 ASP.NET 网页之间传递值

you can store values using the approaches listed there.

您可以使用此处列出的方法存储值。

Eg:

例如:

On your Page 1:

在您的第 1 页上:

Create a textbox named textbox and an asp button.

创建一个名为 textbox 的文本框和一个 asp 按钮。

on button.click code behind add

在 button.click 后面添加代码

Session["test"] = textbox.Text;
Response.Redirect("Page2.aspx"); //Open page 2

On your Page 2 :

在您的第 2 页:

Creata a label named label1

创建一个名为 label1 的标签

Then on its Pageload Event in code behind

然后在它的 Pageload 事件后面的代码中

Add

添加

string IpassAstringfrompage1 = Convert.ToString(Session["test"]);

label1.Text = IpassAstringfrompage1; //label1 will display TESTING from textbox on Page1

To test. On Page1 input "TESTING" on your textbox then click button

去测试。在第 1 页上的文本框中输入“TESTING”,然后单击按钮

Regards

问候