Change CSS classes from code

后端 未结 7 848
误落风尘
误落风尘 2020-12-03 06:17

It\'s easy to set CssClass in the code-behind, but this runs the risk of overwriting existing classes.

I need to set certain elements to ReadOnly

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-03 07:09

    Can you make your own custom classes? Derive from the ASP.NET Button and add a propert for Read only. Somewhere...probably in the OnPreRender, you can check the new property and set (or not set) the CSSClass property accordingly.

提交回复
热议问题