Esempio n. 1
0
    protected void ApplyLayout(int layoutIndex, ASPxGridView grid)
    {
        if (grid != null)
        {
            grid.BeginUpdate();
            try
            {
                grid.ClearSort();
                switch (layoutIndex)
                {
                case 0:
                    grid.GroupBy(grid.Columns["ItemType"]);
                    break;

                case 1:
                    grid.GroupBy(grid.Columns["ItemType"]);
                    grid.GroupBy(grid.Columns["ItemName"]);
                    break;

                case 2:
                    grid.GroupBy(grid.Columns["ItemQty"]);
                    break;
                }
            }
            finally
            {
                grid.EndUpdate();
            }
            grid.ExpandAll();
        }
    }
    private void HandleGridCallback(string parameter)
    {
        string[] parameters          = parameter.Split(':');
        string   target              = parameters[0];
        string   eventArgument       = parameters[1];
        bool     eventArgumentIsTrue = eventArgument == "true";

        switch (target)
        {
        case "PageSize":
            state.PageSize = ChildGrid.SettingsPager.PageSize = Convert.ToInt32(eventArgument);
            break;

        case "Grouping":
            ReadOnlyCollection <GridViewDataColumn> groupedColumns = ChildGrid.GetGroupedColumns();
            foreach (GridViewDataColumn column in groupedColumns)
            {
                ChildGrid.UnGroup(column);
            }
            state.ShowGroupPanel = ChildGrid.Settings.ShowGroupPanel = eventArgumentIsTrue;
            break;

        case "Sorting":
            ChildGrid.ClearSort();
            state.AllowSort = ChildGrid.SettingsBehavior.AllowSort = eventArgumentIsTrue;
            break;

        case "Filtering":
            ChildGrid.FilterExpression = String.Empty;
            state.ShowFilterRow        = ChildGrid.Settings.ShowFilterRow = eventArgumentIsTrue;
            break;
        }
        ChildGrid.DataBind();
    }
Esempio n. 3
0
        protected override void OnViewControlsCreated()
        {
            base.OnViewControlsCreated();
            ASPxGridListEditor listEditor = ((ListView)View).Editor as ASPxGridListEditor;

            if (listEditor != null)
            {
                ASPxGridView gridView = (ASPxGridView)listEditor.Grid;
                gridView.ClientInstanceName = View.Id;
                GridViewDataColumn detailsColums = gridView.Columns["Index"] as GridViewDataColumn;
                if (detailsColums != null)
                {
                    detailsColums.DataItemTemplate = new UpDownButtonsTemplate();
                    gridView.ClearSort();
                    gridView.SortBy(detailsColums, DevExpress.Data.ColumnSortOrder.Ascending);
                    gridView.CustomCallback += new ASPxGridViewCustomCallbackEventHandler(gridView_CustomCallback);
                }
            }
        }