如何从javascript触发服务器端按钮单击事件? [英] How do I fire a server side button click event from javascript?
本文介绍了如何从javascript触发服务器端按钮单击事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
i在aspx中有一个按钮,如下所示
< asp:按钮 < span class =code-attribute> runat = server ID = hdnBtn onclick = hdnBtn_Click 文本 = 点击 >
然后触发按钮点击如下,
< < span class =code-leadattribute> asp:UpdatePanel runat = server ID = updtPanel >
< contenttemplate > ;
---
< / contenttemplate >
< 触发器 >
< asp :AsyncPostBackTrigger ControlID = hdnBtn EventName = 点击 >
< / triggers >
然后,我在下面的for循环中从javascript点击按钮点击事件
document .getElementById( hdnBtn)。click ();
但是,它不会在每次迭代时触发。为什么?
>
谢谢..
解决方案
试试这个可以帮到你
http://stackoverflow.com/questions/8306141/call-button-event-from-java-script [ ^
Hi,
i have a button in aspx as below
<asp:Button runat="server" ID="hdnBtn" onclick="hdnBtn_Click" Text="click">
Then trigger the button click as below,
<asp:UpdatePanel runat="server" ID="updtPanel">
<contenttemplate>
---
</contenttemplate>
<triggers>
<asp:AsyncPostBackTrigger ControlID="hdnBtn" EventName="click">
</triggers>
Then, i fire the button click event from javascript as below in a for loop
document.getElementById("hdnBtn").click();
But, it do not fire at each iteration.why?
Thanks..
解决方案
Try this it may help you
http://stackoverflow.com/questions/8306141/call-button-event-from-java-script[^]
这篇关于如何从javascript触发服务器端按钮单击事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文