日期:2014-05-18  浏览次数:20457 次

旧话重提,如何在Command_Click前用JS检测检测是否为空?为空,则不执行。
如上题。

------解决方案--------------------
为你的button加上onclick事件

<input id= "txtValue " type= "text " />
<asp:button id= "btnSubmit " Text= "Submit "
OnClientClick= "if (document.getElementById( 'txtValue ').value != ' ') return true; else return false; " />
------解决方案--------------------
UseSubmitBehavior = "false "
------解决方案--------------------
OnClientClick= "if (document.getElementById( 'txtValue ').value != ' ') return true; else return false; "
------------------

function check()
{
if (document.getElementById( 'txtValue ').value != ' ') return true; else return false;
}
OnClientClick= "return check() "