I have an action that returns an image:
public void SensorData(int id, int width = 300, int height = 100)
{
using (var repo = new DataRepository())
{
var sensor = repo.GetSensor(id);
if (sensor == null) return;
var chart = new Chart(width, height);
chart.AddSeries(name: "Values",
chartType: "line",
xValue: sensor.DataValues.Select(s => s.Date).ToList(),
yValues: sensor.DataValues.Select(s => s.Value).ToList());
chart.Write();
}
}
This action looks great when I call it from the browser (for example, controller_name / SensorData / 6). The problem is that when I try to view it using Html.RenderAction, I get the following compilation exception on my view:
The best overloaded method match for "System.Web.WebPages.WebPageExecutingBase.Write (System.Web.WebPages.HelperResult)" has some invalid arguments.
This is the code that throws the exception:
@Html.RenderAction("SensorTypes", new { id = 6});
Any ideas on what could be causing this?
thank
source
share