是这样的,我用
<asp:CustomValidator>然后用到onservervalidate="CustomValidator1_ServerValidate"的时候,
我在.cs里面写
protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)函数,
可是为什么只有在点button的时候才能调用函数呢??我想焦点不在 <asp:CustomValidator>所控制的textbox上时,就执行CustomValidator1_ServerValidate函数,怎么弄啊???
急~~谢谢大家!!!!!

解决方案 »

  1.   

    textbox 的autopostback设置为true
      

  2.   

    双击你的textbox有一个 protected void TextBox1_TextChanged(object sender, EventArgs e)
        {    }
    事件
      

  3.   

    您好 谢谢~
    但是我刚试了一下 不可以啊 没有执行我的<asp:CustomValidator>中的验证失败时候的操作啊
      

  4.   

    当textbox 失去焦点时判断是否通过验证
      

  5.   

     <asp:TextBox id="TextBox1" autopostback="true"   onChanged=" onservervalidate"  />
      

  6.   

     autopostback="true"  这个禁用掉 你根本就触发不了TextBox1_TextChanged   1楼+2楼 合起来!
      

  7.   

    TextChanged事件中写
    textbox控件的autopostback属性设置为true