Cannot get new check items

2 posts, 0 answers
  1. Ei Wai
    Ei Wai avatar
    56 posts
    Member since:
    Jul 2014

    Posted 01 Apr 2015 Link to this post

    Hi all,

    I can't get new check items on code behind. I bind the listbox on page load.

    <telerik:RadListBox ID="listBoxEmp" runat="server" CheckBoxes="true" ShowCheckAll="true"
                                                Width="250px" Height="200px" >

    .cs

    List<tbl_Employee> data = GetEmp("");
           if (data != null)
           {
               for (int i = 0; i < data.Count; i++)
                   listBoxEmp.Items.Add(new RadListBoxItem(data[i].ID.ToString() + " | " + data[i].Name.ToString(), data[i].ID.ToString()));
     
           }
     
    There will be other comboboxs. I have to check items based on other combobox selection. So in codebehind,  I do it like this. It will checked all items that returned from query.

    foreach (RadListBoxItem cbi in listBoxEmp.Items)
           {
               if (objEmp.Where(x => x.EmployeeID == cbi.Value).Count() > 0 && cbi.Checked == false)
               {
                   cbi.Checked = true;
                   //checkEmp += cbi.Value + ",";
               }
           }

    After that I also check some more items from the UI but when I click search,new items are not inside the listBoxEmp.CheckedItems list. Please suggest.

    Thank you.

    Best regards,
    Ei Wai
  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1803 posts

    Posted 06 Apr 2015 Link to this post

    Hi Ei,

    From the provided information only it is not clear what your exact scenario and issues are, so can you please elaborate a little more on them. I would also would like to ask you to provide a very simplified example with the issue, so we can test it locally.

    Looking forward to your reply.


    Regards,
    Konstantin Dikov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top