void SetMultiSelectMode(GridView view, DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode multiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.CheckBoxRowSelect) {
	view.OptionsSelection.MultiSelectMode = multiSelectMode;
}

string GetSelectedRows(GridView view) {
	//출처 : DevExpress - "Demo Center 19.2" / WinForms Demos / Data Grid and Editors / UI CUSTOMIZATION / Cell Selection 
    string ret = "";
    int rowIndex = -1;
    if(view.OptionsSelection.MultiSelectMode != GridMultiSelectMode.CellSelect) {
        foreach(int i in gridView1.GetSelectedRows()) {
            DataRow row = gridView1.GetDataRow(i);
            if(ret != "") ret += "\r\n";
            ret += string.Format("{2}: {0} (#{1})", row["CompanyName"], i, Properties.Resources.CompanyName);
        }
    }
    else {
        foreach(GridCell cell in view.GetSelectedCells()) {
            if(rowIndex != cell.RowHandle) {
                if(ret != "") ret += "\r\n";
                ret += string.Format("{1}: #{0}", cell.RowHandle, Properties.Resources.Row);
            }
            ret += "\r\n    " + view.GetRowCellDisplayText(cell.RowHandle, cell.Column);
            rowIndex = cell.RowHandle;
        }
    }
    return ret;
}

 

DevExpress.XtraGrid.Views.Grid.GridView gv = sender as DevExpress.XtraGrid.Views.Grid.GridView;
if (gv.FocusedColumn.FieldName == "DIV_EXP_NO" && gv.ActiveEditor is GridLookUpEdit)
                        {
                            GridLookUpEdit lue = gv.ActiveEditor as GridLookUpEdit;
                            DataTable dt = lue.Properties.DataSource as DataTable;
                            DataView dv = new DataView(dt);
                            string strItem = gv.GetRowCellValue(gv.FocusedRowHandle, gv.Columns["ITEM_NAME"]).ToString();
                            dv.RowFilter = string.Format("ITEM_NAME='{0}'", strItem);
                            lue.Properties.DataSource = dv;
                        }

+ Recent posts