我已经搜索了很长时间,如何在javascript按键内部调用我的public void search()。 asp.net中的Newb谢谢! 这是我的aspx代码。
<script language="javascript" type="text/javascript">
window.addEventListener("keyup", checkKeypress, false);
function checkKeypress(key) {
var TestVar = document.getElementById('<%= Search_Employee.ClientID %>');
'<% search(); %>';
}
</script>
答案 0 :(得分:0)
[System.Web.Services.WebMethod]
public static void GetData()
{
MessageBox.Show("Calling From Client Side");
//Your Logic comes here
}
<asp:ScriptManager ID="ScriptManager2" runat="server" EnablePageMethods="true"/>
<body>
<form id="form1" runat="server">
<script type="text/javascript">
function CallingServerSideFunction() {
PageMethods.GetData();
}
</script>
</form>
</body>