也就是删除的时候,提示一下“确定要删除吗?”。这个问题特指使用内置的导航按钮时。
经过多次试验,解决了。方法如下:
在navigator_click事件中处理写如下代码(我使用的是伪代码,以描述为主)。
先判断点击的按钮,如果是删除按钮,
如要删除,grid.DeleteRow(grid.FocusedRowHandle);update提交删除;
如不删除,任何事情都不做,仅设置e.handle=true;
如何设置编程日期类型的列的过滤条件
这个我经过试验,发现,使用自定义过滤条件对话框时,没有任何问题,一切正常。但,如果编程直接赋值,
Dim
filterstring As
String
filterstring = "[EventDate] >= '"
& FromDate & "' AND [EventDate] =< '"
& ToDate & "'"
Dim
DateFilter As
New
DevExpress.XtraGrid.Columns.ColumnFilterInfo(filterstring)
colEventDate.FilterInfo = DateFilter
其结果是日期类型以字符串的方式比较的,结果不正确。
在网上查了一个方法,未经证实,先记录如下:
[VB.NET]
Imports
DevExpress.Data.Filtering
Imports
DevExpress.XtraGrid.Columns;
Dim
FromDate, ToDate As
DateTime
FromDate = ...
ToDate = ...
Dim
BinaryFilter As
CriteriaOperator
Dim
FilterString, FilterDisplayText As
String
Dim
DateFilter As
ColumnFilterInfo
BinaryFilter = New
GroupOperator(GroupOperatorType.And
, _
New
BinaryOperator("EventDate"
, FromDate, BinaryOperatorType.GreaterOrEqual), _
New
BinaryOperator("EventDate"
, ToDate, BinaryOperatorType.Less))
FilterString = BinaryFilter.ToString()
FilterDisplayText = String
.Format("Event Date between {0:d} and {1:d}"
, FromDate, ToDate)
DateFilter = New
ColumnFilterInfo(FilterString, FilterDisplayText)
colEventDate.FilterInfo = DateFilter
自定义统计方式的使用
今天研究了会儿自定义统计功能。在设计时,可以添加COUNT、AVG、MAX等统计方式,可以设置其显示的位置(在表格下部还是在分组行上)。统计方式中还有个Custom,这个是干什么用的呢?
如果表格里有一个字段有重复值,而要统计共有多少个不同的值时(就相当于使用了distinct),这个统计方式就派上用场了。在SQL语句里,使用一个关键字distinct就搞定了的事,在xtraGrid里可以有些费事。下面我来讲解一下大致的过程。
1.不用说了,在设置窗体里,添加自定义的统计,设定好对应的字段,其方式设置为:Custom
2.处理表格(GridView)的CustomSummaryCalculate的事件,代码如下所示。
//这个注意要保证统计类型为Custom,才能正确统计
int summaryCount;
Hashtable summaryHash;
private void MyCustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e)
{
if (e.SummaryProcess == DevExpress.Data.CustomSummaryProcess.Start)
{
summaryHash = new Hashtable();
summaryCount = 0;
}
else if (e.SummaryProcess == DevExpress.Data.CustomSummaryProcess.Calculate)
{
if (e.FieldValue != null && !summaryHash.Contains(e.FieldValue))
{
summaryHash.Add(e.FieldValue, 1);
summaryCount++;
}
}
else if (e.SummaryProcess == DevExpress.Data.CustomSummaryProcess.Finalize)
{
e.TotalValue = summaryCount;
e.TotalValueReady = true;
summaryHash.Clear();
summaryHash = null;
}
}
3.其实没有了。写一个凑数。运行程序即可。呵呵。
分享到:
相关推荐
XtraGrid控件的用法汇总,大概对这个控件的使用代码
将Excel导入到XtraGrid中 将Excel导入到XtraGrid中
该dll为DevExpress控件的DevExpress XtraGrid3 dll
DXperience XtraGrid 9.3.4 Sources 源代码
XtraGrid帮助文件 Written from the ground-up in C# - the XtraGrid fully exploits and extends upon our many years of experience in building visual controls for the Windows(R) family of operating systems...
XtraGrid 主/从的实现 包含数据库文件
XtraGrid使用心得 分组 排序 自定义 汉化 。。。。。。
WinForm中使用XtraGrid控件,实现在界面中动态修改列显示,列名列宽等
DevExpress.XtraGrid 是一个很强大的表格显示组件,但如果表格的每一列用设计器来设计还是很花时间的,也不通用。但如果使用了这个类,做一个表格就非常简单了,只需传字段、显示的名称、宽度,即可自动生成表格出来...
DevExpress -XtraGrid Demo
我们在使用DEVEXPRESS的DataGridView的时候,会根据不同的条件给单元格指定的不同的背景色,以示区分,但当要把这些背景色导出到Excel文件时发现背景色不见了,该怎么办?
suite fool you - the XtraGrid Suite, is far more than just a grid control. And even more important, if you are committed to delivering top notch features to your customers and want the most ...
AllowIncrementalSearch 允许用户通过输入想得到的列值来定位行 AllowPartialRedrawOnScrolling 允许视图在垂直滚动中局部刷新 AutoExpandAllGroups 自动展开视图中的所有组 ...
控件简单使用例子,报表的数据库没了,还能将就跑一火
XtraGridLookUpEditControl学习视频,希望对大家有用。我用的是DevExpress9.2.9版本的。
DevExpress,XtraGrid,DXperienceUniversal-11.2.10.zip
Devexpress_XtraGrid视频01,视频讲解Devexpress_XtraGrid的使用过程
DevExpress.XtraGrid.GridControl常用功能(增删改),常用。初学者你懂的
since we released the first version of the XtraGrid Suite, our focus has been to deliver ground-breaking new capabilities for Visual Studio .NET®. With XtraGrid Suite v2, you have at your ...
将对象列表绑定到XtraGrid控件的DataSource属性上的实例!