为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;" />

 

 

相关文章:

  • 2022-12-23
  • 2021-11-10
  • 2021-10-11
  • 2022-02-21
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2021-12-18
猜你喜欢
  • 2021-06-06
  • 2022-03-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案