In my aspx file, I have some code that looks like this:
<script type="text/javascript">
var MyVar = '<% =MyFunction() %>';
</script>
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.
I’d like to move this to my code behind. How could I do this?
Thanks.
You can do something like this in your OnLoad: