0
<script>
  var showLowPrice = @Model.ShowLowPrice;
  if(showLowPrice){
    window.alert("LowPrice");
  }
</script>

But when this gets rendered it looks like this

<script>
  var showLowPrice = True;
  if(showLowPrice){
    window.alert("LowPrice");
  }
</script>

and the alert does not show up

Here is the model

public class Store
    {
        public Store() {
          Suggestions = "[]";
          SearchTerm = "";
          ShowLowPrice = true;
        }      
        public string Suggestions { get; set; }
        public string SearchTerm { get; set; }
        public bool ShowLowPrice { get; set; }
    }
Adit
  • 118
  • 11

0 Answers0