如何在asp.net中的页面之间传输文本框值 [英] How to transfer textbox value between pages in asp.net
问题描述
嗨frnds,
我的项目中有3页。我正在使用asp.net c#sql
我想在这些页面之间传递文本框值
我想看到第一个文本框值其他两个页面使用标签
我想使用查询字符串。不是会话
我在第2页获得第一页文本框值但在第3页没有获得
这是我的代码。
首页 - > TxtProjectName
Response.Redirect(CreateTicket.aspx?PName =+ TxtProjectName.Text);
第二页 - >
Hi frnds,
I have 3 pages in my project. am working on asp.net c# sql
I want to pass the textbox value between these pages
I want to see first textbox value in other two pages using label
I want to use query string. not Sessions
am getting the first page textbox value in page2 but not in page3
This is my code.
First Page -> TxtProjectName
Response.Redirect("CreateTicket.aspx?PName=" + TxtProjectName.Text);
second page ->
lblProjectName.Text = Request.QueryString["PName"];
lblProjectName.Visible = true;
在第三页......无法显示文本框值。
请帮忙。
THanks。
In third page..am unable to display the textbox value.
Please help.
THanks.
推荐答案
lblProjectName.Visible = true;
lblProjectName.Text = Convert.ToString(Request.QueryString["PName"]);
Pass the label value of 2nd page to the 3rd page using query string. But I wonder why you don't want to use session. It will do simpler your code and you can access any page's value on any other page.
和前两页一样,
在你的第二页,可能会在某些页面上点击按钮:
Do the same as you have done for the first 2 pages,
In your second page, may be on some button click:
Response.Redirect("page3.aspx?PName=" + lblProjectName.Text;
then在你的page3.aspx页面加载
then in your page3.aspx page load
LabelPage3.Text = Request.QueryString["PName"];
这篇关于如何在asp.net中的页面之间传输文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!