开发者

Calling a server side method in client side in asp.net

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?

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

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

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

             // 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');
            }
      开发者_如何学JAVA      pie1.Draw();
        }
    </script>

How should I change this line to get value from my class which is named messagePercentStats?

RGraph.Pie('pie1',"+Statistics.messagePercentStats(message.getMessageID()) + ")"); %>


I think you might be trying to do this, assuming RGraph.Pie is client-side.

RGraph.Pie('pie1',
           '<%= Statistics.messagePercentStats(
                     ((Message)request.Session["message"]).getMessageID() %>'); 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜