How to add a second css class with a conditional value in razor MVC 4

后端 未结 4 840
傲寒
傲寒 2021-01-30 02:32

While Microsoft has created some automagic rendering of html attributes in razor MVC4, it took me quite some time to find out how to render a second css class on an element, bas

4条回答
  •  情歌与酒
    2021-01-30 03:35

    You can use String.Format function to add second class based on condition:

    0 ? "show" : "hide")">

提交回复
热议问题