How do you programmatically apply a css class to an asp.net control?

前端 未结 7 1706
余生分开走
余生分开走 2021-01-16 11:46

I\'m wondering how I can apply a CSS class to an ASP.NET Control (TextBox in this case) through the backend in C#. For example:



        
7条回答
  •  耶瑟儿~
    2021-01-16 12:21

    It's just a string property of WebControl:

    firstName.CssClass += " selected";
    

提交回复
热议问题