保留跨页面的文本框值

保留跨页面的文本框值

问题描述:

我有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.