Show selected element in Telerik MVC TreeView

this is the code where i create tree in telerik mvc. Now i want to create popup which shows the slected node name.

Html.Telerik().TreeView()
    .Name("ZebTree")
    .ExpandAll(true)
    .ClientEvents(events => events.OnSelect("TreeView_onSelect"))
    .BindTo(Model , map =>
            {
                map.For<TreeViewBind.Models.Category>(bind => bind.ItemDataBound((item, category) => { item.Text = category.CategoryName; }).Children(category => category.Products));
                map.For<TreeViewBind.Models.Product>(bind => bind.ItemDataBound((item, product) => { item.Text = product.ProductName;}));
            }        
    )

Here is the javascript code.

function TreeView_onSelect(e) 
    {
        var treeview = $(this).data('tTreeView');

        alert("You select the node " + ...);

    }

preguntado el 31 de julio de 12 a las 10:07

1 Respuestas

to get a node's text:

function TreeView_onSelect(e) 
{
  var treeview = $(this).data('tTreeView');
  var nodeText = treeview.getItemText(e.item);
  alert("You select the node: " + nodeText);
}

saludos

Respondido 31 Jul 12, 10:07

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.