[英]c# Website Eventhandler + Browser go Back
I want my website to do the onClick event when i click a Button and to go back in the browser i am navigating. 我希望我的网站在单击按钮时执行onClick事件, 并返回到正在导航的浏览器中。
Here is a part of my code for the Button: 这是我的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. 我的问题是,当我单击Button时,它返回但不执行onClick事件。 And if I delete the second line it would do the onClick Event but won't go back in the browser. 如果我删除第二行,它将执行onClick事件,但不会在浏览器中返回。
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 我已经删除了假的回报
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.