This is a migrated thread and some comments may be shown as answers.

[Solved] Nested chart data binding expression not evaluated

0 Answers 58 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chris Neave
Top achievements
Rank 1
Chris Neave asked on 26 Jun 2012, 01:22 PM
I have a grid with a master-detail template and inside the detail of each row is an ajax bound Chart component.  The chart name and parameters for the ajax select therefore use databinding expressions to get the values from the parent row when it is expanded.  The chart id works fine but the parameters for the select URL are not replaced so on the server side the databinding expression is receieved rather than the value.  Here is the source:

@(Html.Telerik().Grid<MeasureParent>()
    .Name("gridParents")
  
    // binding
    .DataBinding(db => db.Ajax()
                         .OperationMode(GridOperationMode.Client)
                         .Select(MVC.MeasureAnalysis.Select()))
  
    // Columns
    .Columns(columns =>
    {
        columns.Bound(x => x.BatchJobCode).MusiDistinctFilter();
        columns.Bound(x => x.EntityCode).MusiDistinctFilter();
        columns.Bound(x => x.DataSetCode).MusiDistinctFilter();
        columns.Bound(x => x.TableName).MusiDistinctFilter();
        columns.Bound(x => x.TableAction).MusiDistinctFilter();
    })
  
    // Master-Detail
    .DetailView(details => details.ClientTemplate(
            Html.Telerik().Chart<MeasurePoint>()
                .Name("chartPoints_<#=ClientId#>")
                .DataBinding(db => db.Ajax()
                                     .Select("SelectPoints", "MeasureAnalysis", new { batchJobCode = "<#=BatchJobCode#>", entityCode = "<#=EntityCode#>", dataSetCode = "<#=DataSetCode#>", tableName = "<#=TableName#>", tableAction = "<#=TableAction#>" }))
                .SeriesDefaults(series =>
                    series.Line().MissingValues(ChartLineMissingValues.Gap)
                )
                .Series(series =>
                {
                    series.Line(mp => mp.ExpectedMeasure).Name("Expected");
                    series.Line(mp => mp.ActualMeasure).Name("Actual");
                })
                .CategoryAxis(axis => axis.Categories(mp => mp.FormattedBusinessDate))
                .ValueAxis(axis => axis.Numeric())
                .HtmlAttributes(new { style = "width:800px; height:300px;" })
                .ToHtmlString()))
  
    // Behaviour
    .Sortable()
    .Filterable()
)

The chart gets given the right name but when MeasureAnalysis/SelectPoints is called it gets passed the literal string "<#=BatchJobCode#>" not the value of batch job code for the row being expanded.

Do you have any suggestions or a workaround?

Thanks
Tags
Chart
Asked by
Chris Neave
Top achievements
Rank 1
Share this question
or