Reputation: 304
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("~/Content/Body.htm")',
}
Upvotes: 0
Views: 177
Reputation: 16174
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.
Upvotes: 1
Reputation: 17794
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.
Upvotes: 0