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

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -