I use Html.Raw(Json.Encode in my Javascript to grab the contents of the ViewModel property passed to the View in my MVC 3 asp.net (razor) application as follows:
var state = @(Html.Raw(Json.Encode(Model.State)));
State is defined in my Model as such
public class IndexViewModel
{
//..other props
public string State { get; set; }
}
It works like a charm in FF, IE8 but chokes on IE 9.
Is there anything I should know about the above code that was changed in IE 9 so this no longer works? If so, what would be the alternative to grab ViewModel data in your JS?
Here is an alternative
view model
base class
view