我在 gridview 页脚中有一个 asp.net 按钮,我想在客户端调用服务器端 ASP.NET 按钮事件 (JavaScript)。
如何执行此操作,如果可能,请编写详细信息。
我的.aspx:
<FooterTemplate>
<asp:ImageButton ID="ibtn_add" ImageUrl="~/Images/accord_plus.png"
runat="server" OnClick="ibtn_add_Click" />
</FooterTemplate>
我想知道如何在客户端调用ibtn_add_Click
。
在以下代码中:
var isShift = false;
document.onkeyup = function(e)
{ if (e.which == 16) isShift = false; }
document.onkeydown = function(e) {
if (e.which == 16) isShift = true;
if (e.which == 13 && isShift == true) {
//Here I wanna to call ibtn_add_Click
return false;
}
}
<小时/>
注意:
更新面板中的 gridview,我通过以下方式执行 JavaScript:
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference Path="~/Scripts/Shortcut.js" />
</Scripts>
</asp:ScriptManager>
最佳答案
关于c# - 如何从客户端调用服务器端 ASP.NET 事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7625437/