|
Article relates to
|
RadScheduler
|
|
Created by
|
Peter, Telerik
|
|
Last modified
|
October 3, 2011
|
|
Last modified by
|
Ivana, Telerik
|
HOW TO
Implement related RadComboBox controls in the advanced form
DESCRIPTION
The advanced form exposes two RadComboBox controls. A selection in the first RadComboBox control updates the data source of the second RadComboBox using a select parameter. The values of the selected items of the RadComboBox controls are stored in
custom attributes. It is important to note that this functionality cannot be achieved using resources and therefore the RadComboBox controls are not resources (although they appear as such). They are manually added controls to the
AdvancedForm user control.
SOLUTION
1. Download a demo project from
here and use the
SqlDataSource sample.
2. Create two new fields of type string for the DbProvider_Classes -
Continent and
Country. The
TelerikVSX.mdf file is in the App_Data folder of the sample.
3. Add the following code in the 'Resource controls' section of the
AdvancedForm.ascx:
ASPX
4. In code behind of the AdvancedForm user control add the following code:
C#
VB.NET
5. In Default.aspx add and bind the
Type and
Resource custom attributes:
<telerik:RadScheduler runat="server" ID="RadScheduler1" Width="750px" AppointmentStyleMode="Default"
StartInsertingInAdvancedForm="true" StartEditingInAdvancedForm="true" OnAppointmentDataBound="RadScheduler1_AppointmentDataBound"
OnClientFormCreated="schedulerFormCreated" CustomAttributeNames="AppointmentColor, Continent, Country"
EnableDescriptionField="True" DataDescriptionField="Description" DataEndField="End"
DataKeyField="ClassID" DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentID"
DataReminderField="Reminder" DataSourceID="SqlDataSource1" DataStartField="Start"
DataSubjectField="Subject">
<AdvancedForm Modal="true" />
<Reminders Enabled="true" />
<AdvancedEditTemplate>
<scheduler:AdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit" Subject='<%# Bind("Subject") %>'
Description='<%# Bind("Description") %>' Start='<%# Bind("Start") %>' End='<%# Bind("End") %>'
RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' Continent='<%# Bind("Continent") %>'
Country='<%# Bind("Country") %>' Reminder='<%# Bind("Reminder") %>' AppointmentColor='<%# Bind("AppointmentColor") %>'
TeacherID='<%# Bind("Teacher") %>' />
</AdvancedEditTemplate>
<AdvancedInsertTemplate>
<scheduler:AdvancedForm runat="server" ID="AdvancedInsertForm1" Mode="Insert" Subject='<%# Bind("Subject") %>'
Start='<%# Bind("Start") %>' End='<%# Bind("End") %>' Description='<%# Bind("Description") %>'
RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' Continent='<%# Bind("Continent") %>'
Country='<%# Bind("Country") %>' Reminder='<%# Bind("Reminder") %>' AppointmentColor='<%# Bind("AppointmentColor") %>'
TeacherID='<%# Bind("Teacher") %>' />
</AdvancedInsertTemplate>
<ResourceTypes>
<telerik:ResourceType DataSourceID="SqlDataSource2" ForeignKeyField="TeacherID" KeyField="TeacherID"
Name="Teacher" TextField="Name" />
</ResourceTypes>
<TimelineView UserSelectable="false" />
<TimeSlotContextMenuSettings EnableDefault="true" />
<AppointmentContextMenuSettings EnableDefault="true" />
</telerik:RadScheduler>
Attached is a demo project.