I add the Related Radboboxes (like city combobox and state combobox) as a usercontrol , there is a problem when i use this usercontrol twice in the same page, when i click the first usercontrol state Combobox it will load the city combobox which is the second usercontrol not the first usercontrol. anybody can help me?
<script type=
"text/javascript"
>
//global variables for the countries and cities comboboxes
var countriesCombo;
var citiesCombo;
function pageLoad() {
// initialize the global variables
// in this event all client objects
// are already created and initialized
countriesCombo = $find(
"<%= ddlState.ClientID %>"
);
citiesCombo = $find(
"<%= ddlCity.ClientID %>"
);
}
function GetStateList(combo, eventArqs) {
var item = eventArqs.get_item();
countriesCombo.set_text(
"Loading..."
);
citiesCombo.clearSelection();
// if a continent is selected
if
(item.get_index() > 0) {
// this will fire the ItemsRequested event of the
// countries combobox 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();
citiesCombo.set_text(
" "
);
citiesCombo.clearItems();
}
}
function GetCityList(combo, eventArqs) {
var item = eventArqs.get_item();
citiesCombo.set_text(
"Loading..."
);
// this will fire the ItemsRequested event of the
// cities combobox passing the countryID as a parameter
citiesCombo.requestItems(item.get_value(),
false
);
}
function ItemsLoaded(combo, eventArqs) {
if
(combo.get_items().get_count() > 0) {
// pre-select the first item
combo.set_text(combo.get_items().getItem(0).get_text());
combo.get_items().getItem(0).highlight();
}
combo.showDropDown();
}
</script>
<tr>
<td><asp:Label ID=
"Label1"
runat=
"server"
AssociatedControlID=
"ddlState"
>state:</asp:Label></td>
<td>
<telerik:RadComboBox ID=
"ddlState"
runat=
"server"
Height=
"200"
OnClientSelectedIndexChanging=
"GetCityList"
OnClientItemsRequested=
"ItemsLoaded"
OnItemsRequested=
"ddlState_ItemsRequested"
>
</telerik:RadComboBox>
</td>
<td></td>
</tr>
<tr>
<td><asp:Label ID=
"Label3"
runat=
"server"
AssociatedControlID=
"ddlCity"
>city:</asp:Label></td>
<td>
<telerik:RadComboBox ID=
"ddlCity"
runat=
"server"
Height=
"200"
OnClientItemsRequested=
"ItemsLoaded"
OnItemsRequested=
"ddlCity_ItemsRequested"
>
</telerik:RadComboBox>
</td>
<td></td>
</tr>
<tr>
<td><asp:Label ID=
"Label2"
runat=
"server"
AssociatedControlID=
"ddlCountryID"
>contry:</asp:Label></td>
<td>
<telerik:RadComboBox ID=
"ddlCountryID"
runat=
"server"
Height=
"200"
OnClientSelectedIndexChanging=
"GetStateList"
OnItemsRequested=
"ddlCountryID_ItemsRequested"
>
</telerik:RadComboBox>
</td>
<td></td>
</tr>
<uc3:Address ID=
"ucBillingAddress"
runat=
"server"
DefaultMode=
"Edit"
ValidationGroup=
"address"
AddressID=
'<% #Bind("AddressID") %>'
FirstName=
'<% #Bind("FirstName") %>'
CompanyName=
'<% #Bind("CompanyName") %>'
PhoneNo=
'<% #Bind("PhoneNo") %>'
FaxNo=
'<% #Bind("FaxNo")%>'
Address1=
'<% #Bind("Address1") %>'
Address2=
'<% #Bind("Address2") %>'
CityID=
'<% #Bind("CityID") %>'
StateID=
'<% #Bind("StateID") %>'
CountryID=
'<% #Bind("CountryID") %>'
ZIPCode=
'<% #Bind("ZIPCode") %>'
/>
<uc3:Address ID=
"ucShippingAddress"
runat=
"server"
DefaultMode=
"Edit"
ValidationGroup=
"address"
AddressID=
'<% #Bind("AddressID") %>'
FirstName=
'<% #Bind("FirstName") %>'
CompanyName=
'<% #Bind("CompanyName") %>'
PhoneNo=
'<% #Bind("PhoneNo") %>'
FaxNo=
'<% #Bind("FaxNo")%>'
Address1=
'<% #Bind("Address1") %>'
Address2=
'<% #Bind("Address2") %>'
CityID=
'<% #Bind("CityID") %>'
StateID=
'<% #Bind("StateID") %>'
CountryID=
'<% #Bind("CountryID") %>'
ZIPCode=
'<% #Bind("ZIPCode") %>'
/>