Hi,maybe there is a simple soluion for my problem...
I decided to implement a DataChartmodel by controller side, so:
private DataChartModel CreateDataChartModel(...) { var dcModel = new DataChartModel(); dcModel.ID = ...; dcModel.Width = "100%"; dcModel.Title = "Title"; dcModel.Subtitle = "Subtitle";
dcModel.DataSource = ....AsQueryable();
dcModel.Axes = new List<AxisModel>();var xAxis = new CategoryXAxisModel {Name = "X", Title = "xTitle", Label = "xLabel"};var yAxis = new NumericYAxisModel {Name = "Y", Title = "yTitle"};dcModel.Axes.Add(xAxis);dcModel.Axes.Add(yAxis);
dcModel.Series = new List<SeriesModel>(); serie = new ColumnSeriesModel();serie.XAxis = "X";serie.YAxis = "Y";serie.ValueMemberPath = "Serie1";serie.Name = "Serie1"; serie.Title = "Serie1"; serie.IsHighlightingEnabled = true;dcModel.Series.Add(serie); dcModel.DataBind();
return dcModel; }
And the view is:
@model DataChartModel
@if (Model != null){ <h2>Chart One</h2> Html.Infragistics().DataChart(Model, "");}else{ <p style="font-style: italic">...</p>}
Am I forgetting something?DataChartModel on the view is right, not null (if statement is done, not else one). But if I look at the rendered view (also in string format) I can just see the h2 tag rendered, not the dataChart...It seems like "Render" is not executed (I tried to add a .Render() but it is not contemplated).
Thanks in advance!!!
Flavio M.
Sorry,
my mistake.
This is the right solution:
@if (Model != null){ <h2>Chart One</h2> @(Html.Infragistics().DataChart(Model, ""));}else{ <p style="font-style: italic">...</p>}
Thanks