单击“返回"超链接时,禁用上一页的刷新页面 [英] disable refreshed page for previous page when clicked on BACK hyperlink

查看:77
本文介绍了单击“返回"超链接时,禁用上一页的刷新页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好.

我有两个.aspx页面,CCSearch.aspx和CCDetails.aspx

我在CCSearch中有一个搜索按钮,该按钮使用基于搜索查询的数据源动态填充gridview.直到单击搜索"按钮为止,gridview才会隐藏.

在此之后,有一个从gridview指向CCDetail页面的链接.

有一个BACK超链接,它带我到CCSearch.aspx.

现在我需要这样的东西.

单击返回"超链接后,它应该提示我进入CCSearch,但无需刷新页面.即文本框和gridview数据应保持原样,并且我不应该有任何空白.我希望你能得到我.

请帮我. :((

hello.

i have two .aspx pages, CCSearch.aspx and CCDetails.aspx

i have a search button in CCSearch which dynamically populates a gridview using datasource based on search query. gridview is hidden until Search button is clicked.

after this there is a link to CCDetail page from gridview.

there is a BACK hyperlink which takes me to CCSearch.aspx.

now i need something like this.

On clicking BACK hyperlink it should tak me to CCSearch but without refreshing the page. i.e. the textboxes and the gridview data should stay as it is and i should not get anything blank. I hope you are getting me.

please help me. :((

推荐答案

有两种方法,
1.导航到ccdetail页面时,可以将ccsearch.aspx的搜索条件存储到会话中.当您从ccdetail导航回到ccsearch时,页面加载会从会话中检索条件并绑定网格.

2.您可以在后退按钮上使用
There are two ways,
1. You can store the search criteria of ccsearch.aspx into session when you are navigating to ccdetail page. And when you navigating back from ccdetail to ccsearch, on page load retrive the criteria from the session and bind the grid.

2. You can use
javascipt: history.back()

javascipt: history.go(-1)


页面将始终经历其生命周期,您无法阻止其刷新.您所能做的就是控制加载过程中发生的事情(即保存并重复使用的内容).您将不希望保存GridView的ViewState(仅在页面的回发期间保留),而是要: 1.)将gridview1本身保存为会话状态变量

2.)将GridView的数据源另存为Session状态变量,以检索并重新填充具有相同结果的GridView.
The page will always go through its life-cycle, you can''t stop it from refreshing. All you can do is control what happens (i.e. what gets saved and reused) while it is loading. Rather than saving the GridView''s ViewState, which only persists during the postbacks of the page, you will want to either:
1.)save the gridview1 itself as a Session state variable
or
2.)save the GridView''s DataSource as a Session state variable to retrieve and repopulate the GridView with the same results.


尝试这一操作,

try this one,

<a href="#" onclick="javascript:history.go(-1); return false;">Back</a>


这篇关于单击“返回"超链接时,禁用上一页的刷新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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