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

TreeView in a Window Checked Values After Postback

2 Answers 64 Views
Window
This is a migrated thread and some comments may be shown as answers.
Sean Mars
Top achievements
Rank 1
Sean Mars asked on 29 Jul 2013, 04:42 PM
I am using "appendTo" to place the Window inside the form. I receive an array with checked values for "checkedNodes" from the TreeView after the postback in FormCollection, but their values are "undefined". The values seem to be binding fine on the client side since I can check that there with no problem.

@* ++++++ View ++++++ *@
@using (Html.BeginForm(null, null, FormMethod.Post, new { name = "frmFind", id = "frmFind" }))
{

@Html.LabelFor(m => m.Things)
@(Html.Kendo().Window()
    .Name("windowThings")
    .Title("Things")
    .Draggable()    
    .Actions(actions => actions
        .Minimize()
        .Maximize()
        .Close()
    ).Visible(false)
    .Resizable().Scrollable(true).Height(350)
    .Content(@<text>
                  @(Html.Kendo().TreeView()
                        .Name("treeThings")
                        .Checkboxes(checkboxes => checkboxes
                                                    .CheckChildren(true)
                        )
                        .DataTextField("Value")
                        )
              </text>)
 )
<span id="buttonOpenThings" class="k-button">Select Things</span>
<script type="text/javascript">
    $("#windowThings").kendoWindow({
        appendTo: "#frmFind"
    });
</script>
}

// ++++++ Controller ++++++
        [HttpPost]
        public ActionResult Index(FormCollection values) 
        {
            var checkedNodes = values["checkedNodes"]; // result is "undefined, undefined, undefined, [etc]"
            return View();
        }

2 Answers, 1 is accepted

Sort by
0
Sean Mars
Top achievements
Rank 1
answered on 29 Jul 2013, 06:27 PM
Figured this out. I just needed to inform the HierarchicalDataSource of the schema. 

                schema: {
                    model: {
                        id: "Id",
                        value: "Value"
                    }
                }
0
Accepted
Sean Mars
Top achievements
Rank 1
answered on 29 Jul 2013, 06:28 PM
I figured this out. I just needed to inform the HierarchicalDataSource of the schema.  schema: { model: { id: "Id",  value: "Value" }   }
Tags
Window
Asked by
Sean Mars
Top achievements
Rank 1
Answers by
Sean Mars
Top achievements
Rank 1
Share this question
or