We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to refresh a chart with callbacks

Hi,

We need to refresh the chart datasource when changing the selected values on comboboxes. I don't want to reload the page. I just need to relaod/replace the partial view where the chart is.
Thanks,

Julien



3 Replies

VK Vijayabharathi K Syncfusion Team November 14, 2011 02:33 PM UTC

Hi Julien,

Thanks for using Syncfusion products.

We suggest you to use Ajax to avoid reload the page when selected values on combo boxes. Please refer the attached sample for this query.

Please us know if you have any concern.

Regards,
Vijayabharathi





Sample_9ece8876.zip


BM Broadcast MAP Limited May 22, 2012 10:10 PM UTC

Hi Vijaya,

We're going with another approach to doing our AJAX, and that is the controller returns a JSON object with the generated HTML string, which Javascript will insert it directly into the page.

My question is how do I generate the HTML string within the Controller. In the View, we use something like:
    Html.Syncfusion().Chart("chart_Model", (MVCChartModel)ViewData["ChartModel"])

But this doesn't compile if I put this in the Controller. It doesn't recognize the first Html class/namespace. What is the equivalent syntax I can use?

Thanks!


VK Vijayabharathi K Syncfusion Team May 23, 2012 07:35 AM UTC

Hi Julien,

 

Thanks for the update.

 

If your intention is to use html helper in controller means, you can use the below code snippet in controller for chart to achieve this,

 

[C#]

  MVCChartModel chartModel = new MVCChartModel();

  InitializeChart(chartModel);

  ViewData["ChartModel"] = chartModel;

   //html helper in controller

  System.IO.TextWriter writer = new System.IO.StringWriter();

  var html = new HtmlHelper(new ViewContext(ControllerContext, new WebFormView(ControllerContext, "Index"), new ViewDataDictionary(), new TempDataDictionary(), writer), new ViewPage());

  var ChartString = html.Syncfusion().Chart("Chart_Model", chartModel);

 

Also, please refer the below forum links to know more details for this,

 

http://stackoverflow.com/questions/6887697/htmlhelper-in-controller

 

http://stackoverflow.com/questions/621235/using-htmlhelper-in-a-controller

 

Please let us know if we misunderstood your query.

 

Regards,

Vijayabharathi

 

 

 


Loader.
Live Chat Icon For mobile
Up arrow icon