Click here to Skip to main content
15,888,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am wondering to know if we can call Resource file into saperate .JS file. for ex. in .cs file I can use it like -

alert('@Resources.NamesofResourceFile.Variable')
this will show alert with text coming from resource file.

In the same way I want to use resource file into .js file but didn't working. I am doing following -

JavaScript
$.processdialog.prompt("<div style="text-align: center; vertical-align: middle;margin-removed 16px"><div> " + '<%= Resources.NewCustomers.Wait %>'+ "</div><img src='/images/loading.gif' alt='Please Wait' /></div>", { width: 260 });

I used above bold line in different way but none of the is retriving the value.

Any help
Kamlesh
Posted
Updated 2-Sep-11 1:07am
v3
Comments
Philippe Mori 2-Sep-11 8:03am    
Do you have a lot of strings? Do you intend to uses them a lot from the client. If you only uses a few string in some specific cases, you can use a web method or an MVC action. If you have a lot of strings, you can write them in the generated page. It all depend on the intended usage.

1 solution

RESX is in xml format, so yes, you can open it and parse it. PERSONALLY, I would parse it in the C# code (since the files would have to be on the server side anyway).

EDIT (after your comment) ============================

If you have to show the text of the file, just open it as a text file, and display it.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900