I have a razor .vbhtml view and would like to use string resources normally accessible via My.Resources. Seems like I can only get to My.Computer, My.Log and couple other namespaces from the view, but not My.Resources. I've tried changing access modifier to public and adding @Imports, neither worked.
Thanks
Right click the Index. cshtml file and select View in Browser. You can also right click the Index. cshtml file and select View in Page Inspector.
Step 1 - Go to SQL Server Management System and execute the following script. Step 2 - Go to Visual studio and add a new project. Select “Asp.Net MVC 4 Web Application” and give the name for this ,In my case it is “MVCDemoProject. ” -> Select a Project template as Empty and View engine is “Razor”, Then Click OK.
Add a Messages.resx
file to your project. In the properties of this file in the solution explorer set Custom Tool = PublicResXFileCodeGenerator
. Now inside the view you can directly access resources:
@Imports AppName.My.Resources
<div>@Messages.Foo</div>
And here's a screenshot containing all you need:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With