Changing Html.DisplayFor boolean checkbox MVC

前端 未结 4 1090
生来不讨喜
生来不讨喜 2021-02-12 07:30

I have a boolean property IsActive. In the view is a list of objects with their properties (including IsActive). But in the list the IsActive is a non-editable checkbox since it

4条回答
  •  无人及你
    2021-02-12 08:02

    You can try this:

    @if (item.IsActive) 
    { 
        @string.Format("Active");
    }
    else
    { 
        @string.Format("Inactive");
    }
    

提交回复
热议问题