如何将文本从一个Web窗体文本框中移动到另一个Web窗体文本框中 [英] How to move text from one web form text box to another web form text box
问题描述
我正在尝试将Admin Web窗体中一个文本框中的文本加载到首页Web窗体"文本框中
I'm trying to load text from one text box in my Admin Web Form, to my Home Page web form text box
我已经尝试过此代码,但由于我的admin类无法从其他Web表单检测到控件,因此我无法使它正常工作.
I have tried this code but I literally can not get it working since my admin class will not detect the control from the other web form..
推荐答案
您可以使用 Session
变量将文本(或数据)从一页传输到另一页.
You can use Session
variables to transfer text (or data) from one page to another.
在源页面中,将数据保存在 Session
变量中:
In the source page, you save the data in the Session
variable:
Session["HomeText"] = txtHomeEntry.Text;
在目标页面中,加载保存文本:
In the destination page, you load the save text:
txtHome.Text = (string)Session["HomeText"];
您可以使用其他 Session
变量(例如 Session ["AboutUs"]
)来传输其他数据.
You can use additional Session
variables (e.g. Session["AboutUs"]
) to transfer the other data.
这篇关于如何将文本从一个Web窗体文本框中移动到另一个Web窗体文本框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!