Reputation: 1010
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!
Upvotes: 1
Views: 83
Reputation: 27614
Try this,
<input type="button" id="btnLikeContent" name="btnLikeContent" value='@(Model.IsUserLikesContent ? "Unlike" : "Like")' />
Upvotes: 2
Reputation: 38102
Try to wrap your value in quote:
value='@{(Model.IsUserLikesContent) ? "Unlike" : "Like"}'
Upvotes: 0