grdtcgrd文件怎么用用

&DevExpress控件使用交流,DevExpress中国社区
当前位置:
& XtraGrid行操作使用技巧
XtraGrid行操作使用技巧
作者:zhuhm&&&来源:evget&&&浏览:Loading...次&&&发布时间:&&&评论:
1、增加新行用InitNewRow事件,给新行某字段赋值。后结束编辑。
private void grdView_InitNewRow(object sender, DevExpress.XtraGrid.Views.Grid.InitNewRowEventArgs e)
DevExpress.XtraGrid.Views.Grid.GridView view = sender as DevExpress.XtraGrid.Views.Grid.GridV
view.SetRowCellValue(e.RowHandle, view.Columns["EnterID"], this.dS_MEnterStoreView.MEnterStore[0].ID);
this.grdControl.EmbeddedNavigator.Buttons.EndEdit.DoClick();
this.grdView.UpdateCurrentRow();
2、如果进行行验证,就在换行时时行,用grdView_FocusedRowChanged事件
private void grdView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
WsClient.WS_MEnterStore.DS_MEnterStoreView.MEnterDetailRow row = (WsClient.WS_MEnterStore.DS_MEnterStoreView.MEnterDetailRow)this.grdView.GetDataRow(e.FocusedRowHandle);
if (row != null)
if ((this.OperState == Common.Enum.TOperState.UnConfirmNew)
|| (this.OperState == Common.Enum.TOperState.UnConfirmEdit))
this.InitComboBoxValue(row, row.IsGoodIDNull()?0:row.GoodID, false);
this.InitBatchComboBoxValue(row, row.IsGoodIDNull()?0:row.GoodID, false);
3、如果需要改变行的某一列的同时改变其它的列用grdView_CellValueChanged事件
private void grdView_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
if (this.grdView.FocusedColumn == e.Column)
if (e.Column == this.colAmount)
4、如果需在离开行的时候需要验证,则用grdView_BeforeLeaveRow事件.
本站文章除注明转载外,均为本站原创或翻译
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 []
本文地址:
相关产品:
请谈谈你的看法 请使用IE或者Firefox浏览器,暂不支持Chrome!
为DevExpress界面控件的中国地区唯一正式授权经销商,正版控件销售公司,授权代理商,经销商及合作伙伴。
***:400-700-1020
&&&&&&&&023-
400-700-1020

参考资料

 

随机推荐