Simple back button in asp.net

In asp I would code <input type = "button" value="Back" onclick=window.history.back(1)> how can this be done in asp.net.

Thanks
mojohysAsked:
Who is Participating?
 
Fahad MukhtarConnect With a Mentor Distinguished EngineerCommented:
write the line in the pageload event:
Button1.Attributes.Add("OnClick", "javascript:history.back(1);return false;")
where Button1 is your serverside asp.net button control
0
 
YZlatCommented:
you can still do this:

<input id="btnBack" type = "button" value="Back" onclick="history.back()">

or

put the following in Page_Load event:
btnBack.Attributes.Add("onlick", "javascript:history.back();")
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.