返回页面时保留数据 [英] keep data when return to a page

查看:194
本文介绍了返回页面时保留数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1.我有2页,p1.aspx和p2.aspx.
2.i在p1.aspx中输入一些数据并导航到p2.aspx
3.当我从p2.aspx返回到p1.aspx时,我想查看p1.aspx中的数据,该数据我
早些进入

怎么可能的???
我正在使用c#

1.I have 2 pages,p1.aspx and p2.aspx.
2.i Enter some data in p1.aspx and navigate to p2.aspx
3. when i come back to p1.aspx from p2.aspx, I want to see the data in p1.aspx which i
had entered earlier

How it posible????
i am using c#

推荐答案

您需要查看ASP.Net中的状态管理.
互联网上有很多关于此的信息.

我相信您会找到最好的链接.对于初学者,请尝试 [
You need to look at state management in ASP.Net.
There is a lot of information for this on the internet.

I''m sure you will find the best links. For starters, try this[^].


唯一的方法要做的就是将其存储在Cookie或服务器端.这取决于您如何导航,哪种方式最适合您:可能最好用JS处理链接并将其存储为cookie,可以通过将其存储在服务器端来最好地处理来自服务器的重定向-这取决于您是否登录了用户,或者临时工-临时工即使从服务器端重定向也需要cookie方法.
The only way you can do it is to store it, either in a cookie, or server side. It depends on how you navigate which way is best for you: a link might be best handled in JS and cookied, a redirect from the server could be best handled by storing it server side - it depends on whether you have logged users in, or casuals - casuals would need the cookie approach even from the server side re-direct.


了解ASP.NET页的生命周期.一旦将其提供给浏览器,除非您告诉服务器,否则服务器对它一无所知.您需要以某种方式持久化数据,无论是数据库还是会话状态.
Understand the lifecycle of an ASP.NET page. Once it has been served to the browser the server knows nothing more about it unless you tell it. You need to persist the data in some fashion, either a database or perhaps session state.


这篇关于返回页面时保留数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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