//获取gridview里面的combo box 显示的文本
//获取某个column在gridview的 index RightGridView.GetColumnByField("FunUID").index//获取gridview里面的combo box 显示的文本RightGridView.batchEditHelper.GetCellTextContainer(visibleindex ,columnIndex).textContent
在Double Click event里面. 获取当前鼠标选择的列的值
在Double Click event里面. 获取当前鼠标选择的值//s.GetFocusedCell().rowVisibleIndex 获取当前选中行的index//s.GetFocusedCell().column.fieldName 获取当前选中行的fields.batchEditApi.GetCellValue(s.GetFocusedCell().rowVisibleIndex,s.GetFocusedCell().column.fieldName)
//自定义计算footer的summary
//自定义计算footer的summary //首先将需要自定义计算的field 设置为 DevExpress.Data.SummaryItemType.Customsettings.CustomSummaryCalculate = (s, e) => { ASPxSummaryItem summary = e.Item as ASPxSummaryItem; if (e.IsTotalSummary) { int li_totalValue = 0; decimal ld_totalValue = 0; for (int i = 0; i < ((MVCxGridView)s).VisibleRowCount; i++) { if (summary.FieldName == "QTY") { if ((((MVCxGridView)s).GetRowValues(i, "TranType") == DBNull.Value ? "" : ((MVCxGridView)s).GetRowValues(i, "TranType").ToString()) == "IN") li_totalValue += Convert.ToInt32(((MVCxGridView)s).GetRowValues(i, "QTY")); else li_totalValue -= Convert.ToInt32(((MVCxGridView)s).GetRowValues(i, "QTY")); e.TotalValue = li_totalValue; } } e.TotalValueReady = true; } };
//在Column里面显示Button(包含当添加新行时无法触发onclick event)
//在Column里面显示Button(包含当添加新行时无法触发onclick event)partial view settings.Columns.Add(column => { column.Caption = "..."; column.FieldName = "btnDlvAddress"; column.UnboundType = DevExpress.Data.UnboundColumnType.String; column.Width = 50; column.SetDataItemTemplateContent(container => { Html.DevExpress().Button(b => { b.Name = "btnDlvAddress" + container.KeyValue; b.Text = "..."; b.Width = Unit.Percentage(100); b.ClientSideEvents.Click = "function(s,e){ OnSearchDlvAddress(); }"; b.ClientEnabled = true; b.EnableClientSideAPI = true; b.ClientVisible = true; }).Render(); }); });
Index.cshtmlfunction OnSearchDlvAddress(){}//使用Gridview的StartEdit event 处理当时新行的时候 call function function OnTruReqGridView_BatchStartEdit(s,e) { e.cancel = true; if(e.focusedColumn.fieldName == "btnDlvAddress") { e.cancel = true; if(ModalTruReqGridView.batchEditApi.IsNewRow(e.visibleIndex)) OnSearchDlvAddress(); }}