|
Article relates to
|
RadScheduler version 2009.2.826 or higher
|
|
Created by
|
Peter, Telerik
|
|
Last modified
|
April 13, 2012
|
|
Last modified by
|
Peter, Telerik
|
HOW TO
add related Load on Demand RadComboBoxes in the advanced form of RadScheduler
DESCRIPTION
This kb article merges the functionalities of the
Related ComboBoxes and the
Advanced Templates demos. The selected values of the two RadComboBoxes are stored using custom attributes. Note that we don't use resources for this case.
SOLUTION
1. Download the attached sample.
2. In
AdvancedForm.ascx add the following code within the
AdvancedControlsPanel:
3. Still in
AdvancedForm.js add the following javascript:
var countriesCombo = null;
function CountriesComboClientLoad(sender) {
countriesCombo = sender;
}
function CountriesLoaded(combo, eventArqs) {
if (combo.get_items().get_count() > 0) {
// Pre-select the first country
combo.set_text(combo.get_items().getItem(0).get_text());
combo.get_items().getItem(0).highlight();
}
combo.showDropDown();
}
function LoadCountries(combo, eventArqs) {
var item = eventArqs.get_item();
countriesCombo.set_text("Loading...");
// Is continent selected?
if (item.get_index() > 0) {
// Request items through the ItemsRequested event of the
// countries RadComboBox passing the continentID as a parameter
countriesCombo.requestItems(item.get_value(), false);
}
else {
// The "-Select a continent-" item was chosen
countriesCombo.set_text(" ");
countriesCombo.clearItems();
}
}
4. In code-behind of
AdvancedForm.ascx add the following:
4.1 In the "
Private Members" region add:
C#
VB.NET
4.2 In the "
Attributes and resources" region add:
C#
VB.NET
4.3 In
Page_Load add:
C#
VB.NET
4.4 In
PreRender add:
C#
VB.NET
5. Copy
Telerik.mdf from your
local installation of the Telerik.Web.UI suit \Live Demos\App_Data to the
App_Data folder of your current web site. In the web.config file add the following connection string:
6. In
Default.aspx, use the following RadScheduler declaration and SqlDataSource:
7. In Default.aspx make sure that the script reference is pointing to the correct location of the AdvancedForm.js file:
Attached is a working demo for reference.
Please
Sign In
to rate this article.