gpt4 book ai didi

c# - asp文本框没有按键事件

转载 作者:太空狗 更新时间:2023-10-30 00:35:03 24 4
gpt4 key购买 nike

您好,我需要处理 asp 文本框的按键事件,但按键事件不适用于 asp 文本框。这个问题有替代方案吗?请帮忙!

最佳答案

利用javascript + textbox的按键事件

并使用ajax或使用pagemthods调用服务器端函数。

.cs file
[ScriptMethod, WebMethod]

public static string docall()
{
return "Hello";
}

.aspx file

<script type="text/javascript">
function btnAccept_onclic() {
PageMethods.docall(onSuccess, onFailure);
}

function onSuccess(result) {
alert(result);
}


function onFailure(error) {
alert(error);
}

</script>

检查这个:http://blogs.microsoft.co.il/blogs/gilf/archive/2008/10/04/asp-net-ajax-pagemethods.aspx

关于c# - asp文本框没有按键事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5865287/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com