简体   繁体   English

如何在Visual Studio 2017上获取所有事件

[英]How to get all events on Visual Studio 2017

I am trying to create a simple WebForm in Visual Studio 2017. I have a textbox and I have to catch "Leave" event on it, but these are the only events available: 我正在尝试在Visual Studio 2017中创建一个简单的WebForm。我有一个文本框,必须在其上捕获“ Leave”事件,但是这些是唯一可用的事件:

大事记

I've been searching for similar questions and problems but I did not find any solutions. 我一直在寻找类似的问题,但没有找到任何解决方案。

There is no Leave event because ASP.NET runs on Server while the user's "leave" happens on the client. 没有Leave事件,因为ASP.NET在服务器上运行,而用户的“离开”发生在客户端上。 You could handle the blur event in JavaScript and then do a post back. 您可以在JavaScript中处理blur事件,然后回发。 Very nice solution is in this SO answer . 这个SO答案是一个很好的解决方案。

This is normal behavior, you're working with a System.Web.UI.WebControls.TextBox . 这是正常现象,您正在使用System.Web.UI.WebControls.TextBox

It doesn't have a Leave event since it's a Web UI control. 由于它是一个Web UI控件,因此没有离开事件。 If you want a Leave event, you'll have to use Javascript (note that this will be Client-Side). 如果您需要离开事件,则必须使用Javascript(请注意,这将是客户端)。

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

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