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

Radlistbox enable/disable checkbox

2 Answers 139 Views
UI for ASP.NET AJAX in ASP.NET MVC
This is a migrated thread and some comments may be shown as answers.
Tamim
Top achievements
Rank 1
Tamim asked on 22 Mar 2013, 01:47 PM

Hi all,
I have used 2 RadlistBox to assign some email id in both Radlistbox.
First listbox mail id check same mailid enable false in another RadListBox how to check

My sample coding here

protected void ToEmail_ItemCheck(object sender, Telerik.Web.UI.RadListBoxItemEventArgs e)
        {
            ToName.Text = "";
            int i = 0;
            foreach (object obj in ToEmail.CheckedItems)
            {
                string ema;
                string item1 = ToEmail.CheckedItems[i].Value;
                ToName.Text += ',' + item1;
                ema = ToEmail.CheckedItems[i].Value;
                foreach (RadListBoxItem item2 in ToEmailCC.Items)
                {
                    if (ToEmailCC.Items[i].Value == ema)
                    {
                        item2.Enabled = false;
                    }
                }
                i++;
            }
        }

Thanks & Advance,
Ansari

2 Answers, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 27 Mar 2013, 01:14 PM
Hello Ansari,

I am not quite sure that I understood your scenario. Assuming that you have 2 RadListBoxes populated with identical data and you want to disable the item from the second RadListBox, corresponding to the one, checked in the first RadListBox I could suggest you the following implementation :

protected void RadListBox1_ItemCheck(object sender, RadListBoxItemEventArgs e)
   {
       RadListBoxItem currentlyCheckedItem = e.Item;
 
       foreach (RadListBoxItem item2 in RadListBox2.Items)
       {
           if (item2.Value == currentlyCheckedItem.Value)
           {
               item2.Enabled = item2.Enabled ? false : true;
           }
        }
   }

Here is a video, demonstrating the behavior at my end.

Kind regards,
Nencho
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Tamim
Top achievements
Rank 1
answered on 13 Apr 2013, 07:55 AM

Thanks for ur reply Nencho
 U r code is working good

Thanks
Ansari

Tags
UI for ASP.NET AJAX in ASP.NET MVC
Asked by
Tamim
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Tamim
Top achievements
Rank 1
Share this question
or