Hi I tried the sample code in for multiple comboxboxes.
My code is below. The problem is it does not load the 2nd boxes items.
This line: LoadCountries(e.Text);
e.Text is always empty. Any ideas why? That is why it's not loading up the next boxes items.
using System;
using System.Data;
using System.Data.OleDb;
using Telerik.WebControls;
using DBUtils;
/// <summary>
/// Summary description for _Default.
/// </summary>
public partial class DefaultCS : System.Web.UI.Page
{
private void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
LoadContinents();
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.RadComboBox1.ItemsRequested += new Telerik.WebControls.RadComboBoxItemsRequestedEventHandler(this.RadComboBox1_ItemsRequested);
this.RadComboBox2.ItemsRequested += new Telerik.WebControls.RadComboBoxItemsRequestedEventHandler(this.RadComboBox2_ItemsRequested);
this.RadComboBox3.ItemsRequested += new Telerik.WebControls.RadComboBoxItemsRequestedEventHandler(this.RadComboBox3_ItemsRequested);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void LoadContinents()
{
DataSet ds = DBHelper.GetRegionsForCombo();
RadComboBox1.DataTextField = "Region";
RadComboBox1.DataValueField = "Region";
RadComboBox1.DataSource = ds;
RadComboBox1.DataBind();
foreach (RadComboBoxItem item in RadComboBox1.Items)
{
item.ToolTip = item.Text;
}
}
private void LoadCountries(string region)
{
if (String.IsNullOrEmpty(region)) return;
DataSet ds = DBHelper.GetPortsForCombo(region);
RadComboBox2.DataTextField = "Port";
RadComboBox2.DataValueField = "Port";
RadComboBox2.DataSource = ds;
RadComboBox2.DataBind();
foreach (RadComboBoxItem item in RadComboBox2.Items)
{
item.ToolTip = item.Text;
}
}
private void LoadCities(string port)
{
DataSet ds = DBHelper.GetFacilityForCombo(port);
RadComboBox3.DataTextField = "Facility";
RadComboBox3.DataValueField = "Facility";
RadComboBox3.DataSource = ds;
RadComboBox3.DataBind();
foreach (RadComboBoxItem item in RadComboBox3.Items)
{
item.ToolTip = item.Text;
}
}
private void RadComboBox1_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
{
LoadContinents();
}
private void RadComboBox2_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
{
LoadCountries(e.Text);
}
private void RadComboBox3_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
{
LoadCities(e.Text);
}
}
My code is below. The problem is it does not load the 2nd boxes items.
This line: LoadCountries(e.Text);
e.Text is always empty. Any ideas why? That is why it's not loading up the next boxes items.
using System;
using System.Data;
using System.Data.OleDb;
using Telerik.WebControls;
using DBUtils;
/// <summary>
/// Summary description for _Default.
/// </summary>
public partial class DefaultCS : System.Web.UI.Page
{
private void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
LoadContinents();
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.RadComboBox1.ItemsRequested += new Telerik.WebControls.RadComboBoxItemsRequestedEventHandler(this.RadComboBox1_ItemsRequested);
this.RadComboBox2.ItemsRequested += new Telerik.WebControls.RadComboBoxItemsRequestedEventHandler(this.RadComboBox2_ItemsRequested);
this.RadComboBox3.ItemsRequested += new Telerik.WebControls.RadComboBoxItemsRequestedEventHandler(this.RadComboBox3_ItemsRequested);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void LoadContinents()
{
DataSet ds = DBHelper.GetRegionsForCombo();
RadComboBox1.DataTextField = "Region";
RadComboBox1.DataValueField = "Region";
RadComboBox1.DataSource = ds;
RadComboBox1.DataBind();
foreach (RadComboBoxItem item in RadComboBox1.Items)
{
item.ToolTip = item.Text;
}
}
private void LoadCountries(string region)
{
if (String.IsNullOrEmpty(region)) return;
DataSet ds = DBHelper.GetPortsForCombo(region);
RadComboBox2.DataTextField = "Port";
RadComboBox2.DataValueField = "Port";
RadComboBox2.DataSource = ds;
RadComboBox2.DataBind();
foreach (RadComboBoxItem item in RadComboBox2.Items)
{
item.ToolTip = item.Text;
}
}
private void LoadCities(string port)
{
DataSet ds = DBHelper.GetFacilityForCombo(port);
RadComboBox3.DataTextField = "Facility";
RadComboBox3.DataValueField = "Facility";
RadComboBox3.DataSource = ds;
RadComboBox3.DataBind();
foreach (RadComboBoxItem item in RadComboBox3.Items)
{
item.ToolTip = item.Text;
}
}
private void RadComboBox1_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
{
LoadContinents();
}
private void RadComboBox2_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
{
LoadCountries(e.Text);
}
private void RadComboBox3_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
{
LoadCities(e.Text);
}
}