This is a migrated thread and some comments may be shown as answers.

[Solved] Rad Grid with in User Control

1 Answer 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mani
Top achievements
Rank 1
mani asked on 16 Apr 2009, 02:01 PM
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

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 22 Apr 2009, 06:02 AM
Hi mani,

To see more information on a possible way to relate the controls, please refer to the following sample.
I hope it gets you started properly.

Regards,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
mani
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or