保留跨页面的文本框值 [英] retain Textbox Values across pages

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

问题描述

我有3个标签,其中每个标签加载不同的页面。当用户通过传递文本框值在page1上搜索时,它返回值。现在,当我转到第2页并返回第1页时,无论用户在第1页上输入什么内容进行搜索,都必须将其保留在文本框中。怎么做。请帮助。

I have 3 tabs, in which each tab loads different pages. when user do search on page1 by passing textbox values it returns values. Now when i move to page2 and come back to page1 whatever user entered on page1 for search, have to retain that in textbox. How to do that. pls assist.

推荐答案

有两种基本方式:

1)Cookies。这些存储在客户端计算机上,所以即使他一周后回来,您也可以检索信息。 http://msdn.microsoft.com/en-us/library /vstudio/ms178194(v=vs.100).aspx [ ^ ]

2)会话。它们存储在服务器上,并在浏览器关闭或大约20分钟不活动后丢失。 http://msdn.microsoft.com/en -us / library / system.web.httpcontext.session(v = vs.110).aspx [ ^ ]



有涉及数据库的其他方式,但除非你强迫用户登录,否则这可能不是你想要做的。
There are two basic ways:
1) Cookies. These are stored on the client computer, so even if he comes back a week later, you can retrieve the info. http://msdn.microsoft.com/en-us/library/vstudio/ms178194(v=vs.100).aspx[^]
2) Session. These are stored on the server, and will be lost when the browser is closed, or after about 20 minutes of inactivity. http://msdn.microsoft.com/en-us/library/system.web.httpcontext.session(v=vs.110).aspx[^]

There are other ways involving databases, but unless you force your users to log in, that is probably not what you want to do.


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

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