开发者

Explain sorting in ASP.NET Dynamic Data

Can anyone explain what the Dynamic Data team was thinking when they designed grid sorting in Dynamic Data scaffolded tables? Sorting defaults to using all columns, in the order the appear in the model, often arbitrary very counter-productive.

W开发者_运维知识库e've just had a run in with the 'out-of-the-box' sorting, and solved it with a simple SortExpression attribute on MetaTables. Another, even simpler solution would have been for them to avoid any sorting, allowing the DB to provide a default order based on clustered index.

Is this another attack of the architecture astronaughts?


The DisplayColumn attribute:

[DisplayColumn("Name", "DOrder", false)]
public partial class Customer { }

allows default sorting specified on Metadata(above I am sorting customers ascending on a column called DOrder).

Or, you can easily add any sort parameters to the grid's datasource using

GridDataSource.OrderByParameters()

.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜