【发布时间】:2010-10-26 04:39:35
【问题描述】:
我正在尝试在自定义 DropDownList 上设置属性:
<custom:ReferenceDropDownList ... ValidityDate="<%# Application.CreateDate %>" />
尽管我可以看到 Application.CreateDate 已在包含 UserControl 的 Page_Load 方法中设置,但 DDL 中的代码隐藏似乎永远不会选择它。
protected override void OnLoad(EventArgs e)
{
// this.ValidityDate is always null
}
ValidityDate="<%# DateTime.Now %>" 也是如此。 DDL 的属性声明如下:
[Category("Data")]
[DefaultValue(null)]
public DateTime? ValidityDate { get; set; }
有谁知道我应该在这里遵循的正确顺序是什么。我认为 DDL 可以轻松评估这样的动态属性值。
【问题讨论】:
标签: asp.net events data-binding drop-down-menu