2
votes

I am doing some fluent markup for Kendo Chart Labels:

.Labels(x =>
    x.DateFormats(formats =>
        formats
        .Days(MyFormat.DateReportByDay)
        .Months(MyFormat.DateReportByMonth))
     .Culture(Thread.CurrentThread.CurrentCulture)

And I get this error:

Compiler Error Message: CS1660: Cannot convert lambda expression to type 'bool' because it is not a delegate type

But if I use this code:

.Labels(x =>
    x.DateFormats(formats =>
        formats
        .Days("dd")
        .Months("MMM yy"))
     .Culture(Thread.CurrentThread.CurrentCulture)

It works fine. My definition for the format variables is

public static class MyFormat
{
    public const string DateReportByMonth = "MMM yy";
    public static string DateReportByDay = "dd";
}

It's saying I can't use a string constant in place of a string?? This is madness!

1
You either made a typo, or have other members defined in your Model, as you have Model.DayFormat in your Linq expression, but MyABDRFormat.DateReportByDay. - Sven Grosen
Usually when I see this error, I need to Clean the solution, rebuild. Sometimes even deleting the @model <Type> line at the top of the Razor file, re-adding it, and re-compiling seems to do the trick. This has driven me crazy in the past too - Didaxis
@SvenGrosen Typo, I've updated the question - user917170

1 Answers

2
votes

Well, looks like @Didaxis was right, I did a rebuild and it seems to be fixed. Weird.