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 void OrderDetailsGridView_CustomCallback(object sender, DevExpress.Web.ASPxGridViewCustomCallbackEventArgs e) { if (e.Parameters == "MakeVisible") { ASPxGridView grid = (ASPxGridView)sender; object key = GetKeyValue(); int visibleIndex = grid.FindVisibleIndexByKeyValue(key); grid.MakeRowVisible(key); grid.ScrollToVisibleIndexOnClient = visibleIndex; grid.FocusedRowIndex = visibleIndex; } }
protected void GridView_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { ASPxGridView gridView = (ASPxGridView)sender; GridDataSource gridDataSource = new GridDataSource(); gridDataSource.InsertRow(e.NewValues, gridView.SettingsDetail.IsDetailGrid); gridView.CancelEdit(); e.Cancel = true; //Navigate to the newly inserted row within the grid and open its details gridView.MakeRowVisible(e.NewValues["ID"]); gridView.DetailRows.ExpandRowByKey(e.NewValues["ID"]); activeTabIndex = 1; }