moving aspx eval to code behind
<p>In my aspx file, I have some code that looks like this:</p>

<pre><code>&lt;script type="text/javascript"&gt;
  var MyVar = '&lt;% =MyFunction() %&gt;';
&lt;/script&gt;
</code></pre>

<p>All this works fine: MyVar actually holds a json string that later gets evaluated on the client. The problem is that this code was designed for a one-time situation and it's turning out to becoming more than a one-time situation and it just looks messy.</p>

<p>I'd like to move this to my code behind. How could I do this?</p>

<p>Thanks.</p>
