How to assign text value to control for bool model

This may be a simple syntax issue, but I have a (bool) model and I want to assign the value attribute to custom text based on the state of the model. Following is my code where I have been stuck for a while now:

<input type="button" id="btnLikeContent" name="btnLikeContent" value=@{(Model.IsUserLikesContent) ? "Unlike" : "Like"} />

The intellisense error I get is "The attribute requires a value, if the value is enclosed in quotation marks, the quotation marks must match"

Any help will be much appreciated!


Try this,

<input type="button" id="btnLikeContent" name="btnLikeContent" value='@(Model.IsUserLikesContent ? "Unlike" : "Like")' />

Try to wrap your value in quote:

value='@{(Model.IsUserLikesContent) ? "Unlike" : "Like"}'

Need Your Help

Play Framework: How do I change active class on route change

java twitter-bootstrap playframework-2.0

I am using Play Framework 2 for Java and Bootstrap Helper in my project and I want to apply active class on sidebar link click. I am using side nav bar for navigation and by default one link is alw...

How to verify whether Site seal logo is preseneted in my site or not by selenium?


I have to capture Site seal. Which provided by third party for my site has been validated and is secured for online transactions. I couldn't capture its element id. If i right click it shows an ale...