简体   繁体   English

TextBox为空时发射事件

[英]Firing event when TextBox is blank

I need to fire an event when a TextBox in ASP.NET has been defocused - I currently handle the TextChanged event for this, but this obviously doesn't fire if they don't type into the box and then defocus. 当ASP.NET中的TextBox已经散焦时,我需要触发一个事件 - 我目前正在为此处理TextChanged事件,但是如果他们没有在框中键入然后散焦,这显然不会触发。 Can I do this? 我可以这样做吗?

EDIT: To clarify, I want to fire a server side event - not client side 编辑:澄清一下,我想发起一个服务器端事件 - 而不是客户端

$('input').blur(function() {
   if ($(this).val() == ''){
      __doPostback('MyMethod')
   }
});

protected void MyMethod()...

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

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