ASPxGridview 自定义排序?按月份名称
我有一个 aspxgridview,它首先按年分组,然后按月分组。基本上我的查询返回月份和年份作为单独的列。现在,如果我将月份返回为“一月或二月”,那么 ASPxGridview 不知道如何对其进行排序。
我听说过自定义排序,但即使如此,如果我将月份列作为数字返回并使用数据项模板将其转换为名称......它可以工作,但在导出时仅导出数字而不是数据项模板。
我真的很困惑,任何人都可以帮助我吗?
谢谢
I have an aspxgridview which groups first by year and then by month. Basically my query returns Month and year as seperate columns. Now if I return month as "January or February" then ASPxGridview does not know how to sort this.
I heard of custom sorting, but even then if I return month column as a number and use dataitem template to convert it to a name...it works but then when exporting it only exports the number not the dataitemtemplate.
I am really confused, can anyone help me here.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,ASPxGridViewExporter 无法导出模板容器中显示的数据。这是因为开发人员可以在其中显示任何控件,而我们无法确定其中显示哪些数据。因此,如果您需要在导出此列数据时显示自定义文本,请使用 ASPxGridViewExporter 的 RenderBrick 事件。但是,更好的解决方案是创建一个未绑定列并使用 ASPxGridView 的 CustomUnboundColumnData 事件处理程序。在这种情况下,您应该拒绝使用DataItemTemplate。
First, the ASPxGridViewExporter cannot export data shown in a template container. This is because a developer can show any control inside it and we cannot determine which data is shown there. So, if you need to show a custom text when this column data is exported, use the ASPxGridViewExporter's RenderBrick event. However, the better solution is to create an unbound column and pass data to this column cells using the ASPxGridView's CustomUnboundColumnData event handler. In this case, you should refuse from using DataItemTemplate.