Completed
Last Updated: 29 Sep 2022 13:33 by ADMIN
Joshua
Created on: 23 Apr 2019 10:47
Category: UI for ASP.NET Core
Type: Bug Report
1
Attaching events in the Sparkline results in a compilation error

Trying to attach an event to the Core Sparkline wrapper like this:

@(Html.Kendo().Sparkline()
                .Name("temp-log")
                .Type(SparklineType.Column)
                .Data(new double[] {
                16, 17, 18, 19, 20, 21, 21, 22, 23, 22
            })
            .Events(e=>e.SeriesClick("onSeriesClick"))
)

leads to a compilation error:

Error CS0121 The call is ambiguous between the following methods or properties: 'SparklineBuilder<T>.Events(Action<ChartEventBuilder>)' and 'SparklineBuilder<T>.Events(Action<SparklineEventBuilder>)'


1 comment
ADMIN
Georgi
Posted on: 29 Sep 2022 13:33

Hi,

The issue is caused since there are two almost identical overloads of the Events method. One accepts an action of SparklineEventBuilder and another accepts an action of ChartEventBuilder. As these builders are not interchangeable, we cannot remove either of them at this point.

To avoid the compilation error, cast the action as shown below:

.Events((Action<Kendo.Mvc.UI.Fluent.ChartEventBuilder>)(e=>e.SeriesClick("onSeriesClick")))
or
.Events((Action<Kendo.Mvc.UI.Fluent.SparklineEventBuilder>)(e=>e.SeriesClick("onSeriesClick")))

I hope this helps.

Regards,
Georgi
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.