简体   繁体   English

如何使链接执行按钮onclick代码?

[英]How to make an link execute a button onclick code?

How can I make a link (anchor) fire a button onclick code while the link is sitting in an Web User Control and the button is sitting in the main .aspx page. 当链接位于Web用户控件中并且按钮位于.aspx主页中时,如何使链接(锚)触发按钮onclick代码。

What I'm trying to accomplish this is to be to export a gridview to excel from a toolbar/utility bar that is sitting in the Web User Control. 我要实现的目标是从Web用户控件中的工具栏/实用工具栏导出一个gridview以使其表现出色。

Any help will really appreciate it. 任何帮助将不胜感激。

<a href="#" onclick="document.getElementById('B').click();">hello</a>
<input type="button" id="B" onclick="alert('HA!');" />

创建服务器端超链接,并将Button1_click()添加到超链接click事件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM