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

[Solved] Post List<TreeViewItem>

0 Answers 29 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tetha
Top achievements
Rank 1
Tetha asked on 20 Sep 2011, 05:22 PM
Hi,
I would to sent back from view to controller the TreeView nodes.

This is the TreeView and the Controller.

@(Html.Telerik().TreeView()
        .Name("TreeView")
        .ClientEvents(e => e.OnSelect("TreeView_onSelect"))
        .BindTo(Model, mappings =>
        {
            mappings.For<Riga>(binding => binding
                .ItemDataBound((item, riga) =>
                {
                    item.Text = riga.Descrizione;
                    item.Value = string.Format("[{0},{1}]", riga.padreID, riga.articoloID);
                })
                .Children(riga => riga.Figli));
        })
)
[HttpPost]
public ActionResult Create(Testata testata, List<TreeViewItem> TreeView)
{
    if (ModelState.IsValid)
    {
        db.Testate.Add(testata);
        db.SaveChanges();
        return RedirectToAction("Index");
    }
 
    return View(testata);
}

The value of TreeView parameter is always null.
Thank you in advance,
Mirko
Tags
TreeView
Asked by
Tetha
Top achievements
Rank 1
Share this question
or