Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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. :((
Posted
Updated 17-Dec-10 19:29pm
v2

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
HTML
javascipt: history.back()
or
HTML
javascipt: history.go(-1)
on the back button of ccdetail.
 
Share this answer
 
Comments
rpriyank007 18-Dec-10 2:10am    
thanks dude. You saved my day. :)
rpriyank007 23-Dec-10 6:56am    
thanks dude. it worked. but its not working for Firefox and Chrome. Its best when used in IE. Any suggestions?
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.
 
Share this answer
 
try this one,

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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900