How to access the resource file using javascript?

Hi,
I have some message that i want to use as popup in javascript from my resource file (globalisation purposes). I have no problem to do that in VB and in the web control.

Please help.
tangteng78Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

HainKurtSr. System AnalystCommented:
show the code for vb first, than we can convert it to javascript
0
tangteng78Author Commented:
Hi,
I have a javascript alert

alert('this should come from resource file')

In resource.resx
name = strAlert
value = "this should come from resource file"

How do i use the javascript (in this case the alert) to call the strAlert in the resource file?
0
HainKurtSr. System AnalystCommented:
in code behibd do this

public msg as string
...
msg = get value from resource file and set it...

and on javascript use this

alert('<%=msg%>');

I hope you know how to get message from resource file...
0
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tangteng78Author Commented:
HainKurt,
this is the error i get. Please advise.

Server Error in '/Muncch Rev4.0' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30455: Argument not specified for parameter 'Number' of 'Public Function Str(Number As Object) As String'.

Source Error:

Line 10:         //Validate web controls other than those supported by validator (eg: checkboxes)
Line 11:         function validate_checkbox() {
Line 12:          alert('<%=str%>');
Line 13:         }
Line 14:  </script>    


Source File: C:\Users\ethan\Documents\Visual Studio 2008\WebSites\Muncch Rev4.0\localization.aspx    Line: 12
0
HainKurtSr. System AnalystCommented:
if str is a public function like this

'Public Function Str(Number As Object) As String'

then you should use like

alert('<%=str(1)%>');

for example...
0
CodeCruiserCommented:
@HainKurt

Are you sure we can use the <% %> inside JavaScript?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.