My customer needs to schedule some tasks with ASP .NET.
I need to save a "Start date" and an "Interval", stored respectively as date (
DateTime) and long (
TimeSpan.Ticks) in my database.
Editing ticks values is not exactly what my customer expects, so I binded the proper
MetaColumn, to the proper
UIHint.
After a few tests, I noticed how my GUI was -
working, but - not easy to understand as I was expecting.
I decided to deeply customize the
FieldTemplateUserControl, to display and save all needed information (
Start Date, Start Time, Occours - Daily, Weekly, Monthly.., etc...).
The solution it's really simple, but there are few points you may need to find out:
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"] = ...; // your logic here
dictionary["TimeInterval"] = ...; // your logic here
}