### Bug report
The DropDownTree TagHelper with enabled checkboxes does not submit the selected options when it is bound to a Model property.
### Reproduction of the problem
1. Define a DropDownTree TagHelper as a form editor and and enable its checkboxes.
2. Bind the editor to a Model property (an array of integers).
3. Submit the form and examine the submit request payload. The values of the selected items are missing.
//Model
public class TestFormModelClass
{
public int[] MonthsSelectedIds { get; set; }
}
//View
@model TestFormModelClass
<form method="post">
<kendo-dropdowntree for="MonthsSelectedIds"
check-all="true"
datatextfield="Month"
datavaluefield="Id">
<hierarchical-datasource type="DataSourceTagHelperType.Custom">
<schema>
<hierarchical-model id="id"></hierarchical-model>
</schema>
<transport>
<read url="/api/items" />
</transport>
</hierarchical-datasource>
<checkboxes check-children="false" name="CheckedMonths" enabled="true" />
</kendo-dropdowntree>
<button type="submit">Save</button>
</form>
### Expected/desired behavior
When the DropDownTree TagHelper with checkboxes is used as a form editor, the values of the selected items must be submitted as expected to the server.
### Workaround
Use the HtmlHelper version of the DropDownTree
### Environment
* **Telerik UI for ASP.NET Core version: 2024.1.319
* **Browser: [all]
DropDownTreeFor with checkboxes enabled is not binding to model value after postback.
Use the following definition of a DropDownTreeFor HtmlHelper in a plain HTML form, where MySelectedIds is int[]
:
@(Html.Kendo().DropDownTreeFor(m => m.MyClass.MySelectedIds)
.Checkboxes(checkboxes => checkboxes
.CheckChildren(false)
)
.DataTextField("MyText")
.DataValueField("MyId")
.AutoClose(false)
.CheckAll(true)
.DataSource(dataSource => dataSource
.Custom()
.Transport(t => t
.Read(r => r.Url("/api/items"))
)
)
)
The DropDownTree is bound to the model value on page load, but on successful form submission and returning the model the DropDownTree is not bound to the data. Refer to ticket 1648108 for a runnable example.
The DropDownTree should be bound to the model value after successful form submission.
Bind the model to a string[]
instead of int[]
.