This question is locked. New answers and comments are not allowed.
Hi,
I'm using the treeview, highly customized and am trying to get set the databound event on the child node. You'll understand better after seeing my code.
this works great and gives me a tree with parent of operations and child of steps. but now, i need to add a second child of tests on those steps. Can I add something like :
to the TreeViewItemModel in the controller, where I can call a second controller method?
Thanks! Jason
I'm using the treeview, highly customized and am trying to get set the databound event on the child node. You'll understand better after seeing my code.
// in my partial view@(Html.Telerik().TreeView() .Name("OperationBrowserTree") .ClientEvents( events => events .OnSelect( "OperationBrowserTree_click" ) ) .BindTo(Model, (item, operation) => { // bind initial data - can be omitted if there is none item.Text = string.Format( HTML BLOCK HERE ); item.Value = 'O' + operation.ID.ToString(); item.LoadOnDemand = operation.Steps.Count() > 0; item.Encoded = false; }) .DataBinding(dataBinding => dataBinding .Ajax().Enabled( true ).Select( "GetOperationBrowserSteps" , "ShopFloor" ) ) )// in my controllerpublic ActionResult GetOperationBrowserSteps( TreeViewItem node ) { int operationID = Convert.ToInt32( node.Value.Substring(1) ); using( var ctx = ErpContextFactory.Create() ) { var steps = ctx.Steps .IncludeRelation( "TestPlanResults/TestPlan" ) .Where( st => st.OperationID == operationID ).OrderBy( st => st.StepNumber ).ToArray().Select( st => new TreeViewItemModel { Text = string.Format( HTML BLOCK HERE), Value = "S" + st.ID.ToString(), Enabled = true, Encoded = false, LoadOnDemand = st.TestPlanResults.Count > 0 } ).ToArray(); return new JsonResult { Data = steps }; } }this works great and gives me a tree with parent of operations and child of steps. but now, i need to add a second child of tests on those steps. Can I add something like :
.DataBinding(dataBinding => dataBinding .Ajax().Enabled( true ).Select( "GetOperationBrowserSteps" , "ShopFloor" ) )to the TreeViewItemModel in the controller, where I can call a second controller method?
Thanks! Jason