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

Treeview model binding to MVC Controller

1 Answer 350 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 06 Sep 2012, 01:59 PM
Good day,

I currently have the following

@Html.Kendo().TreeView()
                            .Name("treeview")
                            .DragAndDrop(true)
                            .DataTextField("Name")
                            .Events(events => events
                                .DragEnd("Change")
                                .Select("Selected")
                                .Expand("OnExpand")
                                )
                            .DataSource(dataSource => dataSource
                                .Read(read => read
                                    .Action("GetTreeViewData", "Home"))
                        );

public JsonResult GetTreeViewData(int? id, string Type) /* how can I get my type property here? */
        {
            //data is returned from db - excluded for brevity
            return Json(data, JsonRequestBehavior.AllowGet);
        }

The question I have is I want, either in my MVC wrapper or through the js widgets to pass through a property called Type from my treeview back to the controller when I expand a Node. How would I go about getting this property to the server when expanding a node?
I explicitally need to know what method to call on the datasource object as I can't find a way to get this property from the client to the server, it's needed as I'm working with data with a composite key...
treeview.dataItem(e.node).Type (with Type being a property in my Json for the Node)

1 Answer, 1 is accepted

Sort by
0
Josh
Top achievements
Rank 1
answered on 29 Jan 2013, 01:46 AM
Did you figure this out? I have the same question. Posted it on Stackoverflow as well - http://stackoverflow.com/questions/14573971/pass-additional-parameter-during-expand-event-for-kendo-treeview
Tags
TreeView
Asked by
John
Top achievements
Rank 1
Answers by
Josh
Top achievements
Rank 1
Share this question
or