c# - Unable to access property using MVC3 Razor -
i want access property
public string gridhtml { get; set; } that have defined in controller. trying access property using javascript, mvc3 razor this
$(document).ready(function() { var str = @model.gridhtml ; } but getting error above variable not defined. can me. in advance.
if have passed model correctly following should work, unless razor syntax not residing inside separate js file
$(document).ready(function() { var str = '@:model.gridhtml'; console.log(str); }
Comments
Post a Comment