I have added a ComboBox control to the AdvancedForm.ascx. When the advanced form is displayed, the selected item in the combobox is not shown. Stepping through the code, I can see radDropDestination.SelectedIndex = dest.Index; properly being set. How do you set the SelectedIndex for the ComboBox or properly bind the Combobox so the selected item is shown when the AdvancedForm.ascx is displayed?
Code behind for AdvancedForm.ascx
From the default.aspx
<
telerik:RadComboBox
ID
=
"radDropDeparture"
runat
=
"server"
Width
=
"350px"
EmptyMessage
=
"-- Depart from ---"
DataSourceID
=
"DataSourceDeparture"
DataTextField
=
"DepartureName"
DataValueField
=
"Id"
Skin
=
"Glow"
MaxHeight
=
"300px"
EnableAutomaticLoadOnDemand
=
"false"
EnableItemCaching
=
"true"
></
telerik:RadComboBox
>
Code behind for AdvancedForm.ascx
[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
public
string
DestinationID
{
get
{
return
radDropDestination.SelectedValue;
}
set
{
if
(value ==
null
)
return
;
radDropDestination.DataBind();
RadComboBoxItem dest = radDropDestination.FindItemByValue(value);
radDropDestination.SelectedIndex = dest.Index;
}
}
From the default.aspx
<
AdvancedEditTemplate
>
<
scheduler:AdvancedForm
runat
=
"server"
ID
=
"AdvancedEditForm1"
Mode
=
"Edit"
Subject='<%# Bind("Subject") %>'
Description='<%# Bind("Description") %>' Start='<%# Bind("Start") %>' End='<%# Bind("End") %>'
RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' Reminder='<%# Bind("Reminder") %>'
DestinationID='<%# Bind("DestinationID") %>' DepartureID='<%# Bind("DepartureID") %>' />
</
AdvancedEditTemplate
>