devDevexpress.XtraGrid.GridControl.GridView 学习记录

 Devexpress.XtraGrid.GridControl.GridView.column.SummaryText   是列总值。

Devexpress.XtraGrid.GridControl.GridView.getRowCellValue(i,"column") 是获取单元格值

gvMain.OptionsBehavior.Editable = true;                               //是否允许用户编辑单元格

对gridcontrol绑定其他控件及其重要的一个属性,默认为false,此时绑定的时候看不到效果。

 

            //修改附加选项
            gvMain.OptionsBehavior.Editable = true;  //是否允许用户编辑单元格只有可以修改单元格才会出现绑定其他控件的显现

            if (dtSource.Columns.Contains("gcPrice") == true)
            {
                GridColumn gcStore = gvMain.Columns.ColumnByFieldName("gcPrice");
                if (gcStore != null)
                {
                    DataLib.DataHelper myHelper = new DataLib.DataHelper();
                    DataSet ds = myHelper.GetDs("select F_ID,F_Name from t_Storage");
                    DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit lupEdit = new DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit();
                    lupEdit.DataSource = ds.Tables[0].DefaultView;
                    lupEdit.ValueMember = "F_ID";
                    lupEdit.DisplayMember = "F_Name";
                    lupEdit.ShowFooter = false;
                    lupEdit.ShowHeader = false;
                    lupEdit.NullText = "";
                    gcStore.ColumnEdit = lupEdit;
                }
            }

            gcMain.EndUpdate();

 

gridcontrol 在编辑数据源的时候FocusedRowHandle的值变为-999998

            int str = gvMain.FocusedRowHandle;
            DataRow drBin = ((DataRowView)binSlaver.AddNew()).Row;
            int str1 = gvMain.FocusedRowHandle;

            binSlaver.EndEdit();

str和str1比较一下便知。

 

 

你可能感兴趣的:(C#)