ASP.NET MVC 4 View ( Razor ) – Single Line If Else + Display Model Value
View |
@model ADLDAP.Entities.UserProfile … … <tr> <td><span class="UserInformationHeader">AD Required Field 1</span></td> <td class="UserProfileCell"> <input class="UserInformationTxtbox" id="Field1" name="Field1" type="text" value="@((Model.LDAPAttr != null && Model.LDAPAttr.Field1 != null )? Model.LDAPAttr.Field1 : "")" /> </td> </tr> <tr> <td><span class="UserInformationHeader">AD Required Field 2</span></td> <td class="UserProfileCell"> <input class="UserInformationTxtbox" id="Field2" name="Field2" type="text" value="@((Model.LDAPAttr != null && Model.LDAPAttr.Field2 != null )? Model.LDAPAttr.Field2 : "")" /> </td> </tr> |