Calling a server side method in client side in asp.net
<p>This is the JavaScript that I have to use in my ASP.NET page, how to change it so that it works in ASP.NET?</p>

<pre><code>&lt;script type="text/javascript"&gt;
        window.onload = function ()
        {
            /**
            * These are not angles - these are values. The appropriate angles are calculated
            */

            &lt;% Message message = (Message)request.getSession().getAttribute("message");

            out.print("var pie1 = new RGraph.Pie('pie1',"+Statistics.messagePercentStats(message.getMessageID()) + ")"); %&gt;

             // Create the pie object
            pie1.Set('chart.key', ['Read', 'Received', 'Not Received']);
            pie1.Set('chart.colors',['#86cf21', '#eaa600', '#e01600']);
            pie1.Set('chart.title', "Message Status");
            pie1.Set('chart.align', 'left');
            pie1.Set('chart.shadow', true);
            pie1.Set('chart.radius', 80);
            pie1.Set('chart.labels.sticks', false);
            pie1.Set('chart.highlight.style', '2d'); // Defaults to 3d anyway; can be 2d or 3d


            if (!RGraph.isIE8()) 
            {
                pie1.Set('chart.zoom.hdir', 'center');
                pie1.Set('chart.zoom.vdir', 'up');
                pie1.Set('chart.labels.sticks', false);
                pie1.Set('chart.labels.sticks.color', '#aaa');
            }
            pie1.Draw();
        }
    &lt;/script&gt;
</code></pre>

<p>How should I change this line to get value from my class which is named <code>messagePercentStats</code>?</p>

<pre><code>RGraph.Pie('pie1',"+Statistics.messagePercentStats(message.getMessageID()) + ")"); %&gt;
</code></pre>
