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

Cannot get new check items

1 Answer 45 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Ei Wai
Top achievements
Rank 1
Ei Wai asked on 01 Apr 2015, 10:08 AM
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

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 06 Apr 2015, 06:41 AM
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.

 
Tags
ListBox
Asked by
Ei Wai
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or