0

如何在选择或单击 Telerik MVC 树视图的节点时调用控制器操作?

<%
= Html.Telerik().TreeView()
            .Name("TreeView1")
            .ClientEvents(events => events
                        .OnSelect("onSelect")
                    )
            .BindTo(Model, mappings =>
            {
                mappings.For<Models.Samples>(binding => binding
                        .ItemDataBound((item, mno) =>
                        {
                            item.Text = mno.A;
                            item.Value = mno.B;
                        }));                     
            })            
%>
4

1 回答 1

1

试试这个它通过点击节点调用你的控制器动作

<%
= Html.Telerik().TreeView()
            .Name("TreeView1")
            .ClientEvents(events => events
                        .OnSelect("onSelect")
                    )
            .BindTo(Model, mappings =>
            {
                mappings.For<Models.Samples>(binding => binding
                        .ItemDataBound((item, mno) =>
                        {
                            item.Text = mno.A;
                            item.Value = mno.B;
                        }));                     
            })            
%>



<script type="text/javascript">
    function onSelect(e) {
        window.location = "/Controller/Action"
    }
</script>
于 2012-10-17T06:01:49.677 回答