change font style in c#

前端 未结 4 557
不思量自难忘°
不思量自难忘° 2020-12-12 00:42

hi there I want to change the font style of a label in an aspx page, through choosing options provided by a dorpdownlist. None of these methods work. I know I might be on th

4条回答
  •  被撕碎了的回忆
    2020-12-12 00:50

    Do you need to make it this way? It's not a 'nice' solution anyway. It's much better to assign an css class. I haven't seen this way before... but I would say that it's comming from WinForms.

    Use CssClass instead:

    label1.CssClass = "SomeClass";
    

    And define styling in your stylesheet:

    .SomeClass { font-family: "Times New Roman"; font-size: 1.2em; }
    

提交回复
热议问题