Combo Box Item Enable False

2 posts, 0 answers
  1. Susi
    Susi avatar
    40 posts
    Member since:
    Jul 2012

    Posted 03 May 2013 Link to this post

    Hi All,

    How to set radcombox item to enable false in one another radcombobox item selected index changed .

    I have implemented code is below. Kindly correct me what i have missed from code.

            protected void radcombo1_OnSelectedIndexChanged(object sender, EventArgs e)
            {
                   string a = radcombo1.SelectedValue.Trim();
                     
                    for (int i = 0; i < radcombo2.Items.Count; i++)
                    {
                        string b = radcombo2.Items[i].Value;
                        string c = radcombo2.Items[i].Text;
     
                       if ((a == "TGROSS") && (b.Substring(0, 2) == "16"))
                       {
                           RadComboBoxItem item = radcombo2.FindItemByText(c);
                           item.Enabled = false;
                          
                       }
                     
                        
                    }
                    radcombo2.SelectedIndex = 0;
    }


    Thanks in Advance..!
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 06 May 2013 Link to this post

    Hi Susi,

    Please have a look at the following server-side code which works fine at my end.

    C#:
    protected void radcombo1_OnSelectedIndexChanged(object sender, EventArgs e)
    {
        string a = radcombo1.SelectedItem.Text.Trim(); // getting the selected text from first radcombobox
     
        foreach (RadComboBoxItem item in radcombo2.Items)
        {
            // looping through all the items in the second RadComboBox.
            string b = item.Value;
            if ((a == "TGROSS") && (b.Substring(0, 2) == "16"))
            {
                item.Enabled = false;
                //disabling the corresponding item.
            }
        }
        radcombo2.SelectedIndex = 0;
    }

    Thanks,
    Princy.
Back to Top