質問

I'm setting up a project with Kendo Ui for the first time, and I'm trying to create Kendo UI dropdown lists, but am getting:

ArgumentNullException was unhandled by user code. --Value cannot be null.

My code is:

@(Html.Kendo().DropDownList()
                        .DataTextField("Text")
                        .DataValueField("Value")
                        .BindTo(new List<SelectListItem>()
                        {
                            new SelectListItem()
                            {
                                Text = "Active",
                                Value = "1"
                            },
                            new SelectListItem()
                            {
                                Text = "In-active",
                                Value = "2"
                            }
                        })
                       .Value("1")
                    )    <-- the error is pointing to here. 

Does anyone know what value is missing?

Thanks,

役に立ちましたか?

解決

Each KendoUI component must have a name specified.

Add this:

.Name("whatYouWantForHtmlId")
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top