如果从同一文本框的javascript fire textchange事件返回true

时间:2015-11-27 07:33:52

标签: javascript c# asp.net

我有一个文本框......

<asp:TextBox ID="txtDateOfPoroposal" runat="server" 
             CssClass="form-control" 
             OnKeydown ="javascript:return Validate(this);" 
             AutoPostBack="True"
             OnTextChanged="txtDateOfPoroposal_TextChanged">
</asp:TextBox>

和javascript函数......

function Validate(obj) {
    var id = obj.id,
    value = obj.value;

    if (value == "") {
        /*some code here*/
        return false;
    } else {
        /*some code here*/
        return true;
    }
}

另外,我有textchange函数.....

protected void txtDateOfPoroposal_TextChanged(object sender, EventArgs e)
{
    /*some code here*/
}

我想先检查验证。如果数据无效,那么在验证后停止回发事件,我想做回发。从我的代码,在有效和invald情况下,回发方法被阻止。请给我解决方案......

0 个答案:

没有答案