How to make String.Format work in conjunction with Resource File values from Javascript?
<p>I have a resource file in Asp.net and I am reading the value from there as follows </p>

<pre><code>var val1 = '&lt;% = Resources.Test.FirstValue%&gt;';  //Hello
var val2 = '&lt;% = Resources.Test.SecondValue%&gt;';  //World          
alert(val1);
alert(val2);
</code></pre>

<p>It does work properly. But Suppose I want to use the String.Format function in C# inorder to make it as "Hello - World" as under</p>

<pre><code>var val3 = '&lt;%= string.Format("{0} - {1}",&lt;% = Resources.Test.FirstValue%&gt;,&lt;% = Resources.Test.SecondValue%&gt; %&gt;';
</code></pre>

<p>It is throwing some compile time error</p>

<pre><code>Invalid expression term '&lt;'
Invalid expression term '='
) expected
; expected
Invalid expression term ')'
</code></pre>

<p>Cannot I use a server side function like that way in Javascript . However, the below works</p>

<pre><code>var val3 = '&lt;%= string.Format("{0} - {1}","Hello","World") %&gt;';
</code></pre>

<p>Well I know that the problem can be solve using javascript itself. I am just curious to see how to get the String.Format function of C# work in Javascript in conjunction with Resource file values.</p>

<p>So, please give the correction /solution pertaining to String.Format and Resource file values only.</p>

<p>Thanks a lot</p>
