请看如下代码:<asp:TextBox ID="TextBox1" runat="server" MaxLength="20" ></asp:TextBox>
我想添加代码为:
<asp:TextBox ID="TextBox1" runat="server" MaxLength="20" onBlur=... ></asp:TextBox>
可是却行不通,请问这是为什么?我该如何写代码??

解决方案 »

  1.   

    因为你用的是.net 控件,所以没有 onBlur 事件
    可以使用 html控件 input type=“text” 
    就有了,
    如果你一定要有.net 控件也是可以的,错误不要管他就行
      

  2.   

    onblur确实ls说的,不过没有没有关系,写上代码照样起作用的
      

  3.   

    用JS写个函数dosth()。后台代码里面写:
    TextBox1.Attributes.Add("onblur", "<script>dosth();</script>");
      

  4.   

    因为是服务端控件,
    要这样添加,在Page_Load中
        protected void Page_Load(object sender, EventArgs e)
        {
            TextBox1.Attributes.Add("onblur", "func()");
        }
      

  5.   

    你可以把html控件放到页面上,然后选择在服务器上运行,把它变成服务器控件,然后看看有没有这个属性