Radlistbox enable/disable checkbox

Thread is closed for posting
3 posts, 0 answers
  1. Tamim
    Tamim avatar
    64 posts
    Member since:
    May 2011

    Posted 22 Mar 2013 Link to this post


    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. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 27 Mar 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Tamim
    Tamim avatar
    64 posts
    Member since:
    May 2011

    Posted 13 Apr 2013 Link to this post


    Thanks for ur reply Nencho
     U r code is working good

    Thanks
    Ansari

Back to Top