我有一個textbox﹐想讓它在客戶端有校驗(只允許輸入數字)﹐并讓它能在PostBack時觸發textchange事件。我該怎么做﹖

解决方案 »

  1.   

    用验证控件!!!把autopostback设成true
      

  2.   

    用验证控件RangeValidator,把type设为Integer
      

  3.   

    把autopostback设成true
    在事件里写代码。
      

  4.   

    已經做了﹐就是當我做客戶端校驗時﹐textbox的postback沒用﹐即不觸發textchange事件
      

  5.   

    aspx:
    <asp:textbox autopostback=true OnTextChanged="name_change"/>
    vb:
        Sub name_change(ByVal sender As Object, ByVal e As System.EventArgs)
           ............
        End sub
      

  6.   

    在page_load里面textbox1.attribute.add("onblur","checkinput();")客户端
    <script language=javascript>
    function  checkinput(str){
      if str!="1111"
      {
        alert("输入错误");
        return;
      }}
    </script>