This is a migrated thread and some comments may be shown as answers.

Treeview checked checkboxes

1 Answer 116 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Julian
Top achievements
Rank 1
Julian asked on 10 Jul 2014, 06:51 AM
Hello,

I integrated a treeview control with checkboxes and a button in my MVC view. If the button is clicked, all checked items should be processed.
However the array which should contain the id value is always null.

Hopefully somebody can give me an advise what I`am doing wrong :-)...

Partial View:
(Html.Kendo().TreeView()
    .Name("Treeview")
    .DataTextField("WebName")
    .Checkboxes(checkBox => checkBox
        .CheckChildren(true)
        .Enabled(true)
        .Name("checkedItems[]")
    )
    .DataSource(dataSource => dataSource
        .Model(model => model
            .Id("WebUrl")
            .HasChildren("HasChildren")
        )
        .Read(read => read
            .Action("WebsRead", "Home")
        )
    )
)

Home:
public ActionResult FillGrid(string[] checkedItems)
        {
            //Do something
 
            return View();
        }

1 Answer, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 10 Jul 2014, 08:11 AM
Hello Julian,

The name of the checkboxes should be checkedItems, not checkedItems[], as shown in the TreeView checkboxes demo. See the offline MVC examples for a working sample.

Regards,
Alex Gyoshev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
TreeView
Asked by
Julian
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Share this question
or