Conditional Html attribute using razor

前端 未结 4 1753
故里飘歌
故里飘歌 2021-02-12 14:46

I have a situation where I want to display a button as being enabled or disabled depending on a property which has been set on the view model.

@if (Model.CanBeDe         


        
4条回答
  •  佛祖请我去吃肉
    2021-02-12 15:30

    
        Delete
    
    

    You can Opt out individual elements from being evaluated as a TagHelper with !(Exclamation Point)

    In its current form, Razor TagHelpers don't allow you to insert attributes by including the string literal of the attribute you want to insert.

提交回复
热议问题