DropDownList Label Syntax Error

1 Answer 29 Views
DropDownList
Brian
Top achievements
Rank 2
Iron
Brian asked on 14 Nov 2023, 03:18 PM

When I try to add a label to a DropDownList, it gives me a syntax error as if the property doesn't exist.  Thoughts?

CS1929
'DropDownListBuilder' does not contain a definition for 'Label' and the best extension method overload 'HtmlHelperLabelExtensions.Label(IHtmlHelper, string)' requires a receiver of type 'Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper'

                    @(Html.Kendo().DropDownList()
                        .Name("PrimaryAnalystId")
                        .Label(label => label.Content("Primary Analyst"))
                        .OptionLabel("[Select a person]")
                        .DataTextField("Person")
                        .DataValueField("PersonId")
                        .DataSource(s => s.Read(r =>
                            r.Action("GetPeople", "Utility", new { type = "analyst" })))
                        .HtmlAttributes(new { required = "required", validationmessage = "Primary analyst is required." }))


1 Answer, 1 is accepted

Sort by
0
Brian
Top achievements
Rank 2
Iron
answered on 16 Nov 2023, 02:19 PM | edited on 16 Nov 2023, 02:27 PM

With the latest Telerik version, the error went away.

I moved from 2022.3.1109 to 2023.3.1114 to fix the issue.

Thanks,
Brian

Mihaela
Telerik team
commented on 17 Nov 2023, 07:21 AM

Thank you for the update, Brian.

The Label() options is available since version 2023.1.117.

Tags
DropDownList
Asked by
Brian
Top achievements
Rank 2
Iron
Answers by
Brian
Top achievements
Rank 2
Iron
Share this question
or