【发布时间】:2010-12-03 02:16:51
【问题描述】:
我有一个带有文本框的起始页面,并且我正在使用缓存在单击下一个按钮时将在文本框中输入的值发送到另一个页面。
现在我有一个问题,当用户转到下一页广告决定再次返回时,他应该能够这样做,并且他在文本框中输入的值应该仍然存在。
有没有办法这样做...
我发送值的代码是:
protected void Button4_Click(object sender, EventArgs e)
{
if (TextBox2.Text == "" || TextBox3.Text == "")
{
Label1.Text = ("*Please ensure all fields are entered");
Label1.Visible = true;
}
else
{
Cache["PolicyName"] = TextBox2.Text;
Cache["PolicyDesc"] = TextBox3.Text;
Response.Redirect("~/Addnewpolicy3.aspx");
}
}
我在下一页收到此信息:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string pn = Cache["PolicyName"].ToString();
string pd = Cache["PolicyDesc"].ToString();
string os = Cache["OperatingSystem"].ToString();
}
}
【问题讨论】:
标签: c# asp.net visual-studio-2008