Hi all,
I can't get new check items on code behind. I bind the listbox on page load.
.cs
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.
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
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