0

I have this snippet in my html... Fusion Charts requires I feed it an XML to create a graph

<script type="text/javascript">
        var myChart = new FusionCharts("/Content/Fusion_Charts/Charts/Column3D.swf", "myChartId", "470", "350", "0", "0");
        myChart.setDataURL("/XML/Graph/?list=<%=Model.list%>");
        myChart.render("Graph");
    </script>

So in my XMLController I simply have a method like this

public ActionResult Graph(FusionChartsList list)
        {
            return View(list);
        }

So my question is... how can I get the object to actually populate when passing it as url parameter??

thanks in advance.

nacho10f
  • 5,816
  • 6
  • 42
  • 73

1 Answers1

0

Call the setDataXML Javascript method with the raw XML string instead.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
  • I dont like that approach cause Im using this particular graph in several places... thats the reason why I created an XML Controller, so that I can generate the XML depending on the data it receives... the data is constructed in the particular Controllers and then sent to this Controller to actually make the XML – nacho10f Aug 30 '10 at 22:03
  • Why don't you call `RenderAction`? (Make sure to escape the Javascript string) – SLaks Aug 30 '10 at 22:07
  • Ok, I have done it a little differently.. I have created a partial View and Im using RenderPartial.. it works just fine except the xml comes with spaces and breaks... so it doesnt seem to work.. Im sure I have to escape the javascript but I wouldnt know how to do it with RenderPartial myChart.setDataXML("<%Html.RenderPartial("Graph", Model.graph_data);%>")); – nacho10f Aug 31 '10 at 14:54