ASPxGridview 自定义排序?按月份名称

发布于 2024-09-27 00:59:27 字数 231 浏览 0 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

段念尘 2024-10-04 00:59:27

首先,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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文