I had a very strange problem, because of which I can not find the reason.
In my ASP.NET MVP application (.net4.0 / MVC4) I am smoothing out the html data attributes inside some html element so that I can use it in JavaScript.
So, in the application, I have a model, for example
public class MyModel{ public bool MyFlag { get; set; } }
Then I pass this model to a simple MVC lookup page and pass the boolean to the html data attribute, for example.
@model MyProject.MyModel <a href="#" data-is-flagged="@Model.MyFlag">Click Me</a>
Now when you start the project locally, html is displayed as:
<a href="#" data-is-flagged="True">Click Me</a>
However, when launched on the server, html is displayed as:
<a href="#" data-is-flagged="data-is-flagged">Click Me</a>
At first, I thought that maybe the boolean value was not set in some way, so I added it to the Click Me @Model.MyFlag , which appears as Click Me True . Now I suspected that this might be due to the Debug vs Release mode, however, after playing with it it made no difference.
My fix was to change the code to output a boolean as a string value, for example. data-is-flagged="@Model.MyFlag.ToString()" , which then displays the same locally on the server.
Any ideas what is the reason for this?