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
Try this:
button1.Click += new EventHandler(btnAnswerSurvey_Click);
button1.Attributes.Add("onClick", "javascript:history.back();");
I have removed the return false
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.