Hi,
I am trying to load my second combobox based on the item selected from first combobox. The code goes something like this
Aspx page
<telerik:RadComboBox ID="DepartmentDD" runat="server" OnItemsRequested="DepartmentDD_ItemsRequested" OnClientSelectedIndexChanging="LoadSection" OnClientItemsRequested="ItemsLoaded" width="175px"/>
<telerik:RadComboBox ID="SectionDD" runat="server" OnItemsRequested="SectionDD_ItemsRequested" OnClientItemsRequested="ItemsLoaded" width="175px" />
function ItemsLoaded(combo, eventarqs) {
var secCombo = $find("SectionDD");
if (combo.get_items().get_count() > 0) {
combo.set_text(combo.get_items().getItem(0).get_text());
combo.get_items().getItem(0).highlight();
}
combo.showDropDown();
}
function LoadSection(combo, eventarqs) {
var seccombo = $find("SectionDD");
var item = eventarqs.get_item();
seccombo .set_text("Loading...");
seccombo .requestItems(item.get_value(), false);
}
---------
CS page
protected void Page_Load(object sender, EventArgs e)
{
LoadDepartment();
}
protected void LoadDepartment()
{
//Loads department to DepartmentDD
}
protected void DepartmentDD_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
{
LoadDepartment();
}
protected void SectionDD_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
{
LoadSection(Convert.ToInt16(deptid));
}
protected void LoadSection(int deptId)
{
//Loads section to SectionDD
}
The problem is when I reach SectionDD_ItemsRequested after selecting item from first combo the control is firing OnInit method which loads the deparment againg :(.
Where am I going wrong?
I am trying to load my second combobox based on the item selected from first combobox. The code goes something like this
Aspx page
<telerik:RadComboBox ID="DepartmentDD" runat="server" OnItemsRequested="DepartmentDD_ItemsRequested" OnClientSelectedIndexChanging="LoadSection" OnClientItemsRequested="ItemsLoaded" width="175px"/>
<telerik:RadComboBox ID="SectionDD" runat="server" OnItemsRequested="SectionDD_ItemsRequested" OnClientItemsRequested="ItemsLoaded" width="175px" />
function ItemsLoaded(combo, eventarqs) {
var secCombo = $find("SectionDD");
if (combo.get_items().get_count() > 0) {
combo.set_text(combo.get_items().getItem(0).get_text());
combo.get_items().getItem(0).highlight();
}
combo.showDropDown();
}
function LoadSection(combo, eventarqs) {
var seccombo = $find("SectionDD");
var item = eventarqs.get_item();
seccombo .set_text("Loading...");
seccombo .requestItems(item.get_value(), false);
}
---------
CS page
protected void Page_Load(object sender, EventArgs e)
{
LoadDepartment();
}
protected void LoadDepartment()
{
//Loads department to DepartmentDD
}
protected void DepartmentDD_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
{
LoadDepartment();
}
protected void SectionDD_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
{
LoadSection(Convert.ToInt16(deptid));
}
protected void LoadSection(int deptId)
{
//Loads section to SectionDD
}
The problem is when I reach SectionDD_ItemsRequested after selecting item from first combo the control is firing OnInit method which loads the deparment againg :(.
Where am I going wrong?