ASP.NET MVC razor: conditional attribute in HTML

后端 未结 7 1658
鱼传尺愫
鱼传尺愫 2020-12-02 15:21

Code below doesn\'t seems clean. Any suggestion to improve the code?

  • class=\
  • 7条回答
    •  -上瘾入骨i
      2020-12-02 15:30

    • You should replace the inline style="..." with a separate classname and use the same syntax there.

      However, it would be cleaner to make a separate HTML helper extension method that takes a page and action name and generates the HTML generically.

    提交回复
    热议问题