void Find(ASPxGridView gridView, string text, int rowIndex, int colIndex)
        {
            ReadOnlyCollection <GridViewDataColumn> groupedColumns = gridView.GetGroupedColumns();

            for (int row = rowIndex; row < gridView.VisibleRowCount; row++)
            {
                for (int col = (row == rowIndex) ? colIndex : 0; col < gridView.Columns.Count; col++)
                {
                    GridViewDataColumn dataColumn = gridView.Columns[col] as GridViewDataColumn;
                    if (dataColumn != null && dataColumn.Visible)
                    {
                        object cellValue = gridView.GetRowValues(row, dataColumn.FieldName);
                        if (cellValue != null && cellValue.ToString().Contains(text))
                        {
                            if ((gridView.GetRowLevel(row) == groupedColumns.Count && !groupedColumns.Contains(dataColumn)) || //Is data row cell
                                (gridView.IsGroupRow(row) && gridView.GetRowLevel(row) == dataColumn.GroupIndex))      //Is group row of the current dataColumn
                            {
                                gridView.MakeRowVisible(gridView.GetRowValues(row, gridView.KeyFieldName));
                                gridView.JSProperties["cpFindText"]           = text;
                                gridView.JSProperties["cpFindPositionRow"]    = row;
                                gridView.JSProperties["cpFindPositionColumn"] = col + 1;
                                gridView.JSProperties["cpFindSomehting"]      = true;
                                return;
                            }
                        }
                    }
                }
            }
            gridView.JSProperties["cpFindPositionRow"]    = 0;
            gridView.JSProperties["cpFindPositionColumn"] = 0;
            gridView.JSProperties["cpFindSomehting"]      = false;
        }
    protected List <int> GetVisibleChildDataRowIndices(ASPxGridView grid, int groupVisibleIndex, out int grouppedRowsCount, out int checkedInvisibleIndecesCount, out int checkedVisibleIndecesCount,
                                                       out CheckState checkState)
    {
        var result       = new List <int>();
        var groupLevel   = grid.GetRowLevel(groupVisibleIndex);
        var visibleStart = grid.VisibleStartIndex;
        var visibleEnd   = visibleStart + Math.Min(grid.VisibleRowCount - visibleStart, grid.SettingsPager.PageSize) - 1;
        var visibleIndex = groupVisibleIndex + 1;

        grouppedRowsCount            = 0;
        checkedInvisibleIndecesCount = 0;
        checkedVisibleIndecesCount   = 0;

        while (grid.GetRowLevel(visibleIndex) > groupLevel)
        {
            var checkValue = (bool)grid.GetRowValues(visibleIndex, GroupCheckBoxFieldName);

            if (!grid.IsGroupRow(visibleIndex) && ((visibleIndex >= visibleStart && visibleIndex <= visibleEnd) && grid.GetRowLevel(visibleIndex) != groupLevel))
            {
                if (checkValue)
                {
                    checkedVisibleIndecesCount++;
                }

                result.Add(visibleIndex);
            }
            else
            {
                if (checkValue)
                {
                    checkedInvisibleIndecesCount++;
                }
            }

            visibleIndex++;
            grouppedRowsCount++;
        }

        checkState = GetCheckState(checkedVisibleIndecesCount + checkedInvisibleIndecesCount, grouppedRowsCount);

        return(result);
    }
    protected void grid_BeforeGetCallbackResult(object sender, EventArgs e)
    {
        ASPxGridView g = sender as ASPxGridView;

        for (int i = 0; i < g.VisibleRowCount; i++)
        {
            if (g.IsGroupRow(i) && !g.IsRowExpanded(i) && g.GetRowLevel(i) > 0)
            {
                g.ExpandRow(i, true);
            }
        }
    }
    protected void grid_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e)
    {
        ASPxGridView g          = sender as ASPxGridView;
        int          groupIndex = g.GetRowLevel(e.VisibleIndex);

        if ((e.RowType == GridViewRowType.Group) && (groupIndex > 0))
        {
            if (e.Row.Cells.Count > groupIndex && e.Row.Cells[groupIndex] != null && e.Row.Cells[groupIndex].Controls.Count > 0)
            {
                e.Row.Cells[groupIndex].Controls[0].Visible = false;
            }
        }
    }
Example #5
0
        private object[] FindGroupValues(ASPxGridView grid)
        {
            grid.DataBind();
            string    column = grid.GetGroupedColumns()[0].FieldName;
            ArrayList list   = new ArrayList();

            for (int i = 0; i < grid.VisibleRowCount; i++)
            {
                if (grid.GetRowLevel(i) == 0)
                {
                    list.Add(grid.GetRowValues(i, column));
                }
            }
            return(list.ToArray());
        }
Example #6
0
        protected void LicenseReport_Click(object sender, EventArgs e)
        {
            try
            {
                string    value     = "";
                DataTable dt        = new DataTable();
                DataTable dtSession = (DataTable)Session["License"];

                //dt.Columns.Add("");
                dt.Columns.Add("LoginName");
                dt.Columns.Add("CompanyName");
                dt.Columns.Add("Units");
                dt.Columns.Add("InstallType");
                dt.Columns.Add("LicenseType");
                dt.Columns.Add("CreatedOn");
                dt.Columns.Add("ExpirationDate");
                dt.Columns.Add("LicenseKey");

                ASPxGridView GridView = (ASPxGridView)LicenseGridView;

                for (int i = 0; i < GridView.VisibleRowCount; i++)
                {
                    if (GridView.GetRowLevel(i) == GridView.GroupCount)
                    {
                        object keyValue = GridView.GetRowValues(i, new string[] { GridView.KeyFieldName });
                        if (keyValue != null)
                        {
                            value = keyValue.ToString();
                            DataRow[] row = dtSession.Select("ID=" + value);
                            foreach (DataRow dr in row)
                            {
                                dt.ImportRow(dr);
                            }
                        }
                    }
                }

                Session["report"] = dt;
                Response.Redirect("~/LicenseReports.aspx", false);
                Context.ApplicationInstance.CompleteRequest();
            }
            catch
            {
            }
        }