0

I want my website to do the onClick event when i click a Button and to go back in the browser i am navigating.

Here is a part of my code for the Button:

button1.Click += new EventHandler(btnAnswerSurvey_Click); button1.Attributes.Add("onClick", "javascript:history.back(); return false;");

My problem is that when I click the Button, it goes back but doesn't execute the onClick Event. And if I delete the second line it would do the onClick Event but won't go back in the browser.

is there any way I could do both thing?

Thank you for your help

Jorge
  • 1
  • See http://stackoverflow.com/questions/5285031/back-to-previous-page-with-header-location-in-php – Tarik Oct 24 '13 at 11:21

1 Answers1

0

Try this:

button1.Click += new EventHandler(btnAnswerSurvey_Click); 
button1.Attributes.Add("onClick", "javascript:history.back();");

I have removed the return false

ED-209
  • 4,706
  • 2
  • 21
  • 26