Linkbutton to previous page

  • Thread starter Thread starter ReidarT
  • Start date Start date
R

ReidarT

How do I program javascript:history.Back on a button
to get me from a page to the previous page

regards
reidarT
 
hi Reidar
Since you choose this group to post such question I guess you mean , how
to do it from with in an aspnet c# page.
If you mean that, may be you can send it directly within your response
like so
Create an asp button control named back and create a handler to its
click event
In the handler of the button click event, add this line of code
Response.Write("<script> history.back() </script>");
Mohamed M .Mahfouz
Developer Support Engineer
ITWorx on behalf of Microsoft EMEA GTSC
 
The best way to do this is from a normal HTML button. Don't use a
server control because it's not necessary. An ordinary html button
will do:
<input type="button" value="Go Back"
onclick="javascript:history.Back()"/>

If you are building controls dynamically, then you can add this line
before adding the control to the page:

btn.Attributes["onclick"] = "javascript:history.Back()";

In general, if the function doesn't require server code, don't use a
server control.

You may get more relavent and timely responses from the ASP.NET
newsgroup.

Best regards,
Jeffrey Palermo
 
Back
Top