为Web控件动态添加样式

为Web控件动态添加样式

aspx:

< asp:TextBox  ID ="TextBox1"  runat ="server" ></ asp:TextBox >

aspx.cs: 

  protected   void  Page_Load( object  sender, EventArgs e)
    {
        TextBox1.Style.Add(
" display " " none " );
    }

 浏览之后,查看源文件:

< input  name ="TextBox1"  type ="text"  id ="TextBox1"  style ="display:none;"   />

 

 

你可能感兴趣的:(Web)