Extjs and asp.net mvc integration
Is it possible to access .net variables, resources etc. from exjs script. For instance how to perform sth like:
items: [{
text: '@ResourceClass.Text',
}
or access url by:
items: [{
url: '@Url.Content("开发者_如何学JAVA~/Content/Body.htm")',
}
That should work as long as that script is inside a cshtml file. However, the parser can get a bit confused by the similarity of javascript and c# code - when this happens modifying the syntax to
url: '@(Url.Content("~/Content/Body.htm"))',
usually gets the parser to recognize the c# component correctly.
you can mix your .NET code with js code in your views but not in external javascript files and extjs is another js library so you can mix extjs code in your views.
精彩评论