从具有原始内容的新页面返回上一页 [英] Going back to the previous page from a new page with original content

查看:55
本文介绍了从具有原始内容的新页面返回上一页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

我正在使用两页.我的问题是使用后退"按钮从新页面移至上一页.但是,当我返回上一页时,该页面中存在的内容将被清除.我希望在移回时保留相同的内容.

请大家帮我提供示例代码吗?


问候,

Dear All,

I am using two pages. My problem is to move from a new page to a previous page using back button. But, when I go back to previous page, the content present in the page are being cleared. I want the same content to be remained when I move back.

Plzzz anyone help me with an example code?


Regards,

推荐答案

尝试此


try this


<asp:LinkButton

                ID="lnk_Back"  OnClientClick="history.go(-1);" runat="server">Back</asp:LinkButton>


您可以执行很多选择.

为了获得总体思路,请在msdn中查看此页面;

ASP.NET会话状态概述 [选项链接 [ ^ ]

一个基本的代码示例是;

You have numerous of options to do that.

In order to get the general idea have a look at this page in msdn;

ASP.NET Session State Overview[^]

Option link[^]

A basic code example is;

object sessionObject = Session["someObject"];
if (sessionObject != null) {
 myLabel.Text = sessionObject.ToString();
}




当我返回上一页时,页面中存在的内容将被清除.我希望在移回时保留相同的内容.

这行听起来像当您单击后退"按钮时,您希望页面的状态相同,

简单的方法是,无论何时,只要您在执行Response.Redirect()行之前单击下一步"按钮,这将带您进入新页面.首先,您必须将所有所需的值(单击后退"按钮单击到会话"变量中以及单击单击"时)返回按钮,您必须再次将已经存储在Session变量中的那些值分配给各自的控件....

好吧,这有点冗长的过程,但是一旦您了解了它,对您来说就很容易了.

全部d最佳.
希望对您有帮助.
Hi,

when I go back to previous page, the content present in the page are being cleared. I want the same content to be remained when I move back.

This line Sounds like u want the Same state of a page when u click on Back button,

The Simple way is Whenever u Click on Next Button before Executing Response.Redirect() Line which will bring you on New page First you have to take all the values Which you want when you click on Back button into Session variable and When you click on BACK button you have to again assign those values which you have already stored in Session variable into your respective Controls....

Well it''s little bit lengthy procedure but once you understand it it is a very easy thing for you.

All d Best.
I Hope this will help you.


这篇关于从具有原始内容的新页面返回上一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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