How do i create a display template so i can display a bool as Yes or No not a checkbox? Using mvc3
<%: Html.DisplayFor(model => model.SomeBoolean)%>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I had to create something similar so it would display “Sim” and “Não” (portuguese Yes/No). I created the following file:
And added the following code:
Hope this helps!
EDIT
Forgot, in your view, simply call it like so:
EDIT 2
For a nullable (bool?), try this:
EDIT 3
Using Razor syntax (Views\Shared\DisplayTemplates\Boolean.cshtml):