Sometimes you need to schedule tasks in ASP.NET and save both a Start Date and an Interval, stored respectively as DateTime and TimeSpan.Ticks in your database.
Editing raw tick values is not exactly good UX, so I bound the proper MetaColumn to the proper UIHint. After some tests, I noticed the GUI was functional but not as intuitive as expected.
The solution was to customize the FieldTemplateUserControl of Dynamic Data, to display and save multiple columns I needed (Start Date, Start Time, Occurs – Daily, Weekly, Monthly, etc.).
How to retrieve values (Schedule_EditField.ascx.cs)
protected override void OnDataBinding(EventArgs e)
{
base.OnDataBinding(e);
DateTime? startFrom = (DateTime?)Eval("StartFrom");
long? timeIntervalTicks = (long?)Eval("TimeInterval");
DateTime? lastExecution = (DateTime?)Eval("LastExecution");
}
How to store values
protected override void ExtractValues(IOrderedDictionary dictionary)
{
dictionary["StartFrom"] = …; // logic here
dictionary["TimeInterval"] = …; // logic here
}
Note (2025): This article dates back to 2008 and refers to ASP.NET Dynamic Data, a framework that is no longer mainstream. Concepts may still be useful historically, but for modern .NET development you should look at more recent frameworks (e.g. ASP.NET MVC, Blazor, or modern data‑binding approaches).