[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 206
  • Last Modified:

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
0
mojohys
Asked:
mojohys
1 Solution
 
Fahad MukhtarDistinguished 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

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

Tackle projects and never again get stuck behind a technical roadblock.
Join Now