The problem is that I cannot create an AdvancedEdit/Insert template using an aspx page, and need to do it on the server side.
So far I can add a resource with the following...
aResource =
new ResourceType("Calendar Color");
aResource.DataSource = GetColors(); // a DataTable with 7 colors and 1 column - "Color"
aResource.KeyField =
"Color";
aResource.TextField =
"Color";
aResource.ForeignKeyField =
"RadSchedulerColor"; // the field in the Scheduler datasource containing 1 of the 7 color values
theScheduler.ResourceTypes.Add(aResource);
The problem is that I want to add new resources with different controls, like a checkbox or a radiobutton. Then I want to be able to set the value based on the Scheduler's datasource. Currently this does not link to the Scheduler so the resource has no default value. I tried to override the OnFormCreated method:
void theScheduler_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
{
if (e.Container.Mode == SchedulerFormMode.AdvancedInsert || e.Container.Mode == SchedulerFormMode.AdvancedEdit)
{
DropDownList colors = (DropDownList)e.Container.FindControl("Calendar Color");
colors.SelectedValue =
"Red";
colors.Width =
new Unit(100, UnitType.Percentage);
}
}
This only increased the width, it doesn't set the SelectedValue. Am I doing this right? Is what I'm trying to do possible without creating a custom UserControl with aspx elements?