views:

20

answers:

1

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.

A: 

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

SLaks
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
NachoF
Why don't you call `RenderAction`? (Make sure to escape the Javascript string)
SLaks
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 RenderPartialmyChart.setDataXML("<%Html.RenderPartial("Graph", Model.graph_data);%>"));
NachoF