2013-04-22 81 views
0

我使用ASP.NET动态数据,并有一两件事我想这样做是有一个元类,例如自动填充下拉列表现在,两个字段SchoolID和DestinationSchoolID是来自“学校”表的下拉列表。ASP.NET动态数据基于元数据

是否有我可以用来自动填充这些下拉列表,他们是什么属性?

回答

0

您应该使用FilterUIHintAttribute类,该类允许在CopyTermsHolidays实体上替换(或添加新过滤器)默认过滤器。

例如:

[Required] 
[UIHint("AcademicYear")] 
[FilterUIHint("AcademicYearFilter")] 
public int AcademicYear { get; set; } 

AcademicYearFilter哪里是需要被位于~\DynamicData\Filters目录(AcademicYearFilter.ascx)自定义过滤器。

有关更多信息,请致电FilterUIHintAttribute Class

我会勇敢地连接到我的回答过滤模板查找算法和一些
ASP.NET动态 引文数据UNLEASHED

Compared to the lookup rules for field templates, lookup rules for filter templates are simple. Dynamic Data uses only the FilterUIHint associated with the column and has an intrinsic knowledge of several column types. If the FilterUIHint is not specified in the data model, and the column is Foreign Key (a column that represents the parent navigation property of a many-to-one or a one-to-one association in the child entity), a Boolean, or an enumeration, Dynamic Data chooses a predefined FilterUIHint value, ForeignKey, Boolean, or Enumeration, respectively. Having the FilterUIHint value, Dynamic Data tries to locate a user control with the matching name in the DynamicData\Filters directory of the web application project. If the user control does not exist, the lookup process ends, and filtering is considered to be unsupported for this column.

enter image description here