Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
hi,
 
I Created a web form(first page) .It contains some details about a person and a print
 
button.I click the print button it go to second page .This page will get the crystal report.I
 
clicked the print button on the report and show preview of crystal report print and take
 
the print.second page also contain back button. I need when click the back button it go to
 
first page without reloading.but I click the back button it go to previous state of current
 
page. Because second page was more time reloaded .
 
Can I go to first page when I click the back button in first time?
 
I place th belowcode in pageload.
 
this.Lbtnback.OnClientClick = "window.history.go(-1);return false;";
Posted 1-Oct-10 3:23am
jijilkb492
Edited 2-Oct-10 5:19am
v2
Comments
Sunasara Imdadhusen at 1-Oct-10 8:26am
   
Please provide more clarification over you question?
what you exactly want like you have to go Back as like Browser button or else Redirection using Response.Redirect?
Sandeep Mewara at 1-Oct-10 11:56am
   
More info from OP: i am trying create a back button in my code. i want to go to specific page when i click on it and that page should not refresh because some details entered in that page i tried history.go("url") but it's not working is there any other way to do this.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

Please make your question clear.
// go back to previous page
<input type=button value="back" onclick='history.go(-1)'>
 
Response.Redirect("PreviousPage.aspx");
 
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 7

hi,
 
I Created a web form(first page) .It contains some details about a person and a print
 
button.I click the print button it go to second page .This page will get the crystal report.I
 
clicked the print button on the report and show preview of crystal report print and take
 
the print.second page also contain back button. I need when click the back button it go to
 
first page without reloading.but I click the back button it go to previous state of current
 
page. Because second page was more time reloaded .
 
Can I go to first page when I click the back button in first time?
 
I place the belowcode in pageload.
 
this.Lbtnback.OnClientClick = "window.history.go(-1);return false;";
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 8

Pass page path (with querystring) so you know where you came from to this page.. and on back button put something like this
<code>
<asp:Button runat="server" ID='btnBack' OnClientClick="fnJSgotoPrevious(<%= PreviousPage %>);return false;" />
</code>
then you have to define a JS on your page
<code>
<script language="javascript">
function fnJSgotoPrevious(previousPage)
{
document.window.location.href=previousPage;
}
</script>
</code>
in your code behind define this property
<code>
protected string PreviousPage
{
get { return Request.QueryString("PreviousPage");}
}
</code>
and when you call this page you have to pass extra parameter in previouspage now..
something like this
<code>
Response.Redirect("ReportPage.aspx?PreviousPage=ThisPageName.aspx");
</code>
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Hi
 
You can try following:
 
<a href="javascript:history.go(-1)">Go back</a>
 
Please do let me know, if you have any doubt.
 
Please provide "Vote" if this would be helpful, and make "Accept Answer" if this would be correct answer.Rose | [Rose]
 
Thanks,
Imdadhusen
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 277
1 BillWoodruff 205
2 Maciej Los 205
3 DamithSL 165
4 Sergey Alexandrovich Kryukov 145
0 OriginalGriff 5,107
1 DamithSL 4,157
2 Maciej Los 3,595
3 Kornfeld Eliyahu Peter 3,450
4 Sergey Alexandrovich Kryukov 2,741


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 3 Oct 2010
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100