protected void tree_CustomCallback(object sender, DevExpress.Web.ASPxTreeList.TreeListCustomCallbackEventArgs e)
    {
        if (String.IsNullOrWhiteSpace(e.Argument))
        {
            return;
        }
        var param = e.Argument.Split(';');

        if (param.Length < 2)
        {
            return;
        }
        var context     = new NorthwindDataClassesDataContext();
        var currentNode = context.Employees.Where(empl => empl.EmployeeID == Convert.ToInt32(param[0])).FirstOrDefault();
        var copyNode    = context.Employees.Where(empl => empl.EmployeeID == Convert.ToInt32(param[1])).FirstOrDefault();

        if (ProcessNodes(tree.FindNodeByKeyValue(copyNode.EmployeeID.ToString()), currentNode.EmployeeID.ToString()))
        {
            copyNode.ReportsTo = currentNode.EmployeeID;
            //coment the below line to enable updates
            throw new CallbackException("Updates aren't allowed in online demo");
            context.SubmitChanges();
            tree.DataBind();
        }
        else
        {
            throw new CallbackException("You're trying to move a parent node to its child");
        }
    }
示例#2
0
 protected void ASPxTreeList1_CustomCallback(object sender, DevExpress.Web.ASPxTreeList.TreeListCustomCallbackEventArgs e)
 {
     //Guid guid = Guid.Parse(cbAccountType.Value.ToString());
     //AccountType accountType = session.GetObjectByKey<AccountType>(guid);
     //CriteriaOperator criteria = new BinaryOperator("AccountTypeId!Key",accountType.AccountTypeId);
     //AccountXPO.Criteria = criteria.ToString();
     //ASPxTreeList1.DataBind();
 }
示例#3
0
 protected void PermissionsTree_CustomCallback(object sender, DevExpress.Web.ASPxTreeList.TreeListCustomCallbackEventArgs e)
 {
     PermissionsTree.UnselectAll();
     if (RolesGrid.FocusedRowIndex > -1)
     {
         new Permission().ListRolePermissions((int)RolesGrid.GetRowValues(RolesGrid.FocusedRowIndex, "ID")).ForEach(p =>
         {
             PermissionsTree.FindNodeByKeyValue(p.ID.ToString()).Selected = true;
         });
     }
 }
        // drag-and-drop to reorder nodes
        protected void ASPxTreeList1_CustomCallback(object sender, DevExpress.Web.ASPxTreeList.TreeListCustomCallbackEventArgs e)
        {
            ASPxTreeList tl = (ASPxTreeList)sender;

            if (e.Argument.StartsWith("reorder:"))
            {
                string[] arg = e.Argument.Split(':');
                SwapNodes(tl.FindNodeByKeyValue(arg[1]), tl.FindNodeByKeyValue(arg[2]));
                tl.DataBind();
            }
        }
        protected void TreeList_CustomCallback(object sender, DevExpress.Web.ASPxTreeList.TreeListCustomCallbackEventArgs e)
        {
            string[] callbackParams = e.Argument.Split('|');
            bool     isSwap         = false;
            int      draggedKey     = -1;
            int      targetKey      = -1;

            if (callbackParams.Length == 3 &&
                Int32.TryParse(callbackParams[0], out draggedKey) &&
                Int32.TryParse(callbackParams[1], out targetKey) &&
                Boolean.TryParse(callbackParams[2], out isSwap) &&
                isSwap)
            {
                dataHelper.SwapDataItems(dataHelper.Data.Find(i => i.Key == draggedKey), dataHelper.Data.Find(i => i.Key == targetKey));

                TreeList.DataSource = dataHelper.Data;
                ((ASPxTreeList)sender).DataBind();
            }
        }
示例#6
0
 protected void ASPxTreeList1_CustomCallback(object sender, DevExpress.Web.ASPxTreeList.TreeListCustomCallbackEventArgs e)
 {
 }
        protected void treeList_CallBack(object sender, DevExpress.Web.ASPxTreeList.TreeListCustomCallbackEventArgs e)
        {
            ASPxTreeList tree = sender as ASPxTreeList;

            tree.RefreshVirtualTree();
        }