Hi
I called the user control with in rad grid. The User Control to have associated Drop down Like wise Country, state, City...
If i Selected the Destination. that time the state Loaded but the the first drop down(Destination is post back) and show the precious data. I want to need Proper association Let me know how can i handled this problem
My Code is
/// <summary>
/// Load Destination Data From DataBase
/// </summary>
public void LoadDestinationFromDB()
{
try
{
IList<AreaData> areaSearch = new List<AreaData>();
areaSearch = areaManager.GetDestinations();
cmbMasterInfoDestination.DataSource = areaSearch;
cmbMasterInfoDestination.DataTextField = "Name";
cmbMasterInfoDestination.DataValueField = "ID";
cmbMasterInfoDestination.DataBind();
RadComboBoxItem cmbParentArea = new RadComboBoxItem();
cmbParentArea.Text = " ";
cmbMasterInfoDestination.Items.Insert(0, cmbParentArea);
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// Load the Sub Area Details From Database
/// </summary>
/// <param name="o">Destination ID</param>
/// <param name="e"></param>
protected void cmbMasterInfoDestination_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
{
JSSessionHandler.SetSessionValue("PropertyDestination", "5");
if ((cmbMasterInfoArea.SelectedIndex != 0) && (cmbMasterInfoDestination.SelectedIndex != 0))
{
IList<AreaData> subAreaData = new List<AreaData>();
subAreaData = areaManager.GetSubArea(Convert.ToInt64(cmbMasterInfoDestination.SelectedValue));
cmbMasterInfoArea.DataSource = subAreaData;
cmbMasterInfoArea.DataTextField = "Name";
cmbMasterInfoArea.DataValueField = "ID";
cmbMasterInfoArea.DataBind();
RadComboBoxItem cmbSubArea = new RadComboBoxItem();
cmbSubArea.Text = " ";
cmbMasterInfoArea.Items.Insert(0, cmbSubArea);
}
if ((cmbMasterInfoDestination.SelectedIndex == 0) || (cmbMasterInfoDestination.SelectedIndex == -1))
{
cmbMasterInfoArea.Items.Clear();
cmbMasterInfoLocation.Items.Clear();
}
}
/// <summary>
/// Load the Location Details From DataBase
/// </summary>
/// <param name="o">Area Id</param>
/// <param name="e"></param>
protected void cmbMasterInfoArea_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
{
if ((cmbMasterInfoLocation.SelectedIndex != 0) && (cmbMasterInfoArea.SelectedIndex != 0))
{
IList<AreaData> locationData = new List<AreaData>();
locationData = areaManager.GetChildArea(Convert.ToInt64(cmbMasterInfoArea.SelectedValue));
cmbMasterInfoLocation.DataSource = locationData;
cmbMasterInfoLocation.DataTextField = "Name";
cmbMasterInfoLocation.DataValueField = "ID";
cmbMasterInfoLocation.DataBind();
RadComboBoxItem cmbLocation = new RadComboBoxItem();
cmbLocation.Text = " ";
cmbMasterInfoLocation.Items.Insert(0, cmbLocation);
}
else
{
cmbMasterInfoLocation.Items.Clear();
}
}
Regards
G. Manikandan
I called the user control with in rad grid. The User Control to have associated Drop down Like wise Country, state, City...
If i Selected the Destination. that time the state Loaded but the the first drop down(Destination is post back) and show the precious data. I want to need Proper association Let me know how can i handled this problem
My Code is
/// <summary>
/// Load Destination Data From DataBase
/// </summary>
public void LoadDestinationFromDB()
{
try
{
IList<AreaData> areaSearch = new List<AreaData>();
areaSearch = areaManager.GetDestinations();
cmbMasterInfoDestination.DataSource = areaSearch;
cmbMasterInfoDestination.DataTextField = "Name";
cmbMasterInfoDestination.DataValueField = "ID";
cmbMasterInfoDestination.DataBind();
RadComboBoxItem cmbParentArea = new RadComboBoxItem();
cmbParentArea.Text = " ";
cmbMasterInfoDestination.Items.Insert(0, cmbParentArea);
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// Load the Sub Area Details From Database
/// </summary>
/// <param name="o">Destination ID</param>
/// <param name="e"></param>
protected void cmbMasterInfoDestination_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
{
JSSessionHandler.SetSessionValue("PropertyDestination", "5");
if ((cmbMasterInfoArea.SelectedIndex != 0) && (cmbMasterInfoDestination.SelectedIndex != 0))
{
IList<AreaData> subAreaData = new List<AreaData>();
subAreaData = areaManager.GetSubArea(Convert.ToInt64(cmbMasterInfoDestination.SelectedValue));
cmbMasterInfoArea.DataSource = subAreaData;
cmbMasterInfoArea.DataTextField = "Name";
cmbMasterInfoArea.DataValueField = "ID";
cmbMasterInfoArea.DataBind();
RadComboBoxItem cmbSubArea = new RadComboBoxItem();
cmbSubArea.Text = " ";
cmbMasterInfoArea.Items.Insert(0, cmbSubArea);
}
if ((cmbMasterInfoDestination.SelectedIndex == 0) || (cmbMasterInfoDestination.SelectedIndex == -1))
{
cmbMasterInfoArea.Items.Clear();
cmbMasterInfoLocation.Items.Clear();
}
}
/// <summary>
/// Load the Location Details From DataBase
/// </summary>
/// <param name="o">Area Id</param>
/// <param name="e"></param>
protected void cmbMasterInfoArea_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
{
if ((cmbMasterInfoLocation.SelectedIndex != 0) && (cmbMasterInfoArea.SelectedIndex != 0))
{
IList<AreaData> locationData = new List<AreaData>();
locationData = areaManager.GetChildArea(Convert.ToInt64(cmbMasterInfoArea.SelectedValue));
cmbMasterInfoLocation.DataSource = locationData;
cmbMasterInfoLocation.DataTextField = "Name";
cmbMasterInfoLocation.DataValueField = "ID";
cmbMasterInfoLocation.DataBind();
RadComboBoxItem cmbLocation = new RadComboBoxItem();
cmbLocation.Text = " ";
cmbMasterInfoLocation.Items.Insert(0, cmbLocation);
}
else
{
cmbMasterInfoLocation.Items.Clear();
}
}
Regards
G. Manikandan