Changing Html.DisplayFor boolean checkbox MVC

前端 未结 3 1668
一向
一向 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

3条回答
  •  不知归路
    2021-02-12 07:55

    You can try this:

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

提交回复
热议问题