I’d like a div to show if a ViewModel bool is set to true.
I tried this:
$(function () {
$("#myDiv").toggle(@Model.IsRequired);
}
But @Model.IsRequired appears as either “True” or “False”, rather than “true” or “false”.
Any ideas?
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.
You can just write
@Model.IsRequired.ToString().ToLower().I don’t think there’s any better solution (other than your own extension method)