我要把一个TextBox加入如下的CSS样式该如何做呢?
<input type="text" name="username" class="inp"  onMouseOver="this.style.borderColor='#9ecc00'"                        onMouseOut="this.style.borderColor='#84a1bd'"/>

解决方案 »

  1.   

    private void Page_Load(object sender, System.EventArgs e)
    {
    this.TextBox1.Attributes.Add("nMouseOver","this.style.borderColor='#9ecc00';");
           this.TextBox1.Attributes.Add("onMouseOut","this.style.borderColor='#84a1bd'");}
      

  2.   

    或者在一个style.css文件里设定好这个样式,然后this.TextBox1.CssClass = "样式名称"
      

  3.   

    this.TextBox1.Attributes.Add("onMouseOver","this.style.borderColor='#9ecc00'");
    this.TextBox1.Attributes.Add("onMouseOut", "this.style.borderColor='#84a1bd'");
      

  4.   

    楼主给出的是html控件,上面两位的方法不行的哦,还是用htc代码吧。