protected void rcbState_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        RadComboBox      rdState    = (RadComboBox)o;
        GridEditFormItem editItem   = (GridEditFormItem)rdState.NamingContainer;
        RadComboBox      rdCity     = (RadComboBox)editItem.FindControl("rcbCity");
        RadComboBox      rcbCountry = (RadComboBox)editItem.FindControl("rcbCountry");

        //Label lblCity = (Label)editItem.FindControl("lblCity");
        if (rcbCountry.SelectedValue == "--Select--")
        {
            ShowPopUpMsg("Please Select Country");
        }
        else if (rdState.SelectedValue == "--Select--")
        {
            ShowPopUpMsg("Please Select State");
        }
        else
        {
            if (Session["SignInOrganizationId"] != null)
            {
                _clientid = Convert.ToInt32(Session["SignInOrganizationId"].ToString());
            }

            _countryid = Convert.ToInt32(rcbCountry.SelectedValue);
            _stateid   = Convert.ToInt32(rdState.SelectedValue);
            rdCity.Items.Clear();
            DataSet dscity = populatecity(_countryid, _stateid);
            if (dscity.Tables.Count > 0 && dscity.Tables[0].Rows.Count > 0)
            {
                rdCity.DataSource     = dscity;
                rdCity.DataTextField  = "CityName";
                rdCity.DataValueField = "CityId";
                rdCity.DataBind();
                RadComboBoxItem ascityListItem = new RadComboBoxItem("--Select--", "--Select--");
                rdCity.Items.Insert(0, ascityListItem);
                rdCity.Focus();
            }
            else
            {
                rdCity.DataSource = null;
                rdCity.DataBind();
                RadComboBoxItem ascityListItem = new RadComboBoxItem("--Select--", "--Select--");
                editItem["CityName"].Parent.Visible = false;
                //rdCity.Visible = false;
                //lblCity.Visible = false;
                rdCity.Items.Insert(0, ascityListItem);
            }
        }
    }
Exemple #2
0
        protected void cbRole_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            int id;

            if (int.TryParse(e.Value, out id))
            {
                RadComboBox combo = (sender as RadComboBox);
                if ((from r in Targets where r.TargetType == SSOMessageTarget.Role && r.Target == id select r).Count() == 0)
                {
                    Targets.Add(new ListItem()
                    {
                        Name = e.Text, TargetType = SSOMessageTarget.Role, Target = id
                    });
                }

                combo.Text = "";
                combo.ClearSelection();
                combo.Focus();
                RefreshUI();
            }
        }
    protected void rcbCountry_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        RadComboBox      rdCountry = (RadComboBox)o;
        GridEditFormItem editItem  = (GridEditFormItem)rdCountry.NamingContainer;
        RadComboBox      rdState   = (RadComboBox)editItem.FindControl("rcbState");
        RadComboBox      rdCity    = (RadComboBox)editItem.FindControl("rcbCity");
        RadComboBox      rcbclient = (RadComboBox)editItem.FindControl("rcbclient");


        if (rcbclient.SelectedValue == "--Select--")
        {
            ShowPopUpMsg("Please Select Client");
        }
        else if (rdCountry.SelectedValue == "--Select--")
        {
            ShowPopUpMsg("Please Select Country");
        }
        else
        {
            _clientid  = Convert.ToInt32(rcbclient.SelectedValue);
            _countryid = Convert.ToInt32(rdCountry.SelectedValue);
            rdState.Items.Clear();

            string[] strArrCountryids = ("2,12,15,18,26,29,35,51,54,66,75,87,93,96,98,117,121,123,133,135,136,140,148,156,158,162,163,176,181,187,188,199,205,212,218,219").Split(',');
            if (strArrCountryids.Contains(_countryid.ToString()))
            {
                DataSet dscity = populatestate(_countryid);

                if (dscity.Tables.Count > 0 && dscity.Tables[0].Rows.Count > 0)
                {
                    rdCity.DataSource     = dscity;
                    rdCity.DataTextField  = "CityName";
                    rdCity.DataValueField = "CityId";
                    rdCity.DataBind();
                    RadComboBoxItem ascityListItem = new RadComboBoxItem("--Select--", "--Select--");
                    rdCity.Items.Insert(0, ascityListItem);
                    rdCity.Focus();
                    editItem["CityName"].Parent.Visible = true;
                }
                else
                {
                    rdCity.DataSource = null;
                    rdCity.DataBind();
                    RadComboBoxItem ascityListItem = new RadComboBoxItem("--Select--", "--Select--");
                    rdCity.Items.Insert(0, ascityListItem);
                }

                editItem["StateName"].Parent.Visible = false;
            }
            else
            {
                DataSet dsstate = populatestate(_countryid);
                if (dsstate.Tables.Count > 0 && dsstate.Tables[0].Rows.Count > 0)
                {
                    rdState.DataSource     = dsstate;
                    rdState.DataTextField  = "StateName";
                    rdState.DataValueField = "StateId";
                    rdState.DataBind();
                    RadComboBoxItem asstateListItem = new RadComboBoxItem("--Select--", "--Select--");
                    rdState.Items.Insert(0, asstateListItem);
                    rdState.Focus();
                }
                else
                {
                    rdState.DataSource = null;
                    rdState.DataBind();
                    RadComboBoxItem asstateListItem = new RadComboBoxItem("--Select--", "--Select--");
                    rdState.Items.Insert(0, asstateListItem);
                }

                editItem["StateName"].Parent.Visible = true;
                editItem["CityName"].Parent.Visible  = true;
            }
        }
    }