ASP.NET动态数据DisplayColumn属性导致排序问题 [英] ASP.NET Dynamic Data DisplayColumn Attribute Causing Sorting Issue

查看:85
本文介绍了ASP.NET动态数据DisplayColumn属性导致排序问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用罗斯文(Northwind)数据库中的LINQ to SQL DataContext使用ASP.NET动态数据...

Using ASP.NET Dynamic Data with a LINQ to SQL DataContext from the Northwind Database...

当我向我的LINQ to SQL entity类中添加一个DisplayColumn属性并从局部类中的自定义代码引用一个属性时,我无法在生成的 GridViews <中按该列进行排序/em>.即使我将非自定义属性引用为sortColumn,我仍然无法进行排序.

When I add a DisplayColumn Attribute to one of my LINQ to SQL entity classes and reference a property from my custom code in the partial class, I lose the ability to sort by that column in the generated GridViews. I continue to lose the ability to sort even if I reference a non-custom property as the sortColumn.

为什么会这样?

示例代码:

[DisplayColumn("LastNameFirstName", "LastName", false)]
public partial class Employee
{
    public string LastNameFirstName
    {
        get { return LastName + ", " + FirstName; }
    }
}

亚伦

sortColumn指定当用作外键(在 DropDownList 中)而不是在 GridView .

The sortColumn specifies the column that will be used to sort this entity when it is used as a foreign key (in a DropDownList), not when it is being sorted in the GridView.

推荐答案

这可能是设计使然...

This may be by Design...

"sortColumn"指定用于在此实体用作外键时(在DropDownList中)而不是在GridView中对其进行排序时将用于对该实体进行排序的列.

The "sortColumn" specifies the column that will be used to sort this entity when it is used as a foreign key (in a DropDownList), not when it is being sorted in the GridView.

这篇关于ASP.NET动态数据DisplayColumn属性导致排序问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆