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

Combo Box Item Enable False

1 Answer 136 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Susi
Top achievements
Rank 1
Susi asked on 03 May 2013, 11:14 AM
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..!

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 06 May 2013, 05:28 AM
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.
Tags
ComboBox
Asked by
Susi
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or