I have a RadListBox with multi-select turned on. On selection of another list control, in the code-behind of the other list control, I get its value, then select records from a database, and want to select the corresponding items in the RadListBox (called "listWho" below). When walking thru the code, it is selecting the list box items, but, after postback, the list box shows not selected items. Why?
Here is the code. Any help appreciated. Dan
Here is the code. Any help appreciated. Dan
<
telerik:RadListBox
ID
=
"listWho"
runat
=
"server"
DataSourceID
=
"dsScheduleWho"
TabIndex
=
"2"
DataTextField
=
"wholist"
DataValueField
=
"pk"
Height
=
"120px"
Width
=
"169px"
Skin
=
"Vista"
SelectionMode
=
"Multiple"
OnClientLoad
=
"listWho_ClientLoad"
>
</
telerik:RadListBox
>
protected void DistGroup_SelectedIndexChanged(object sender, EventArgs e)
{
string itemValue;
DropDownList ddl = sender as DropDownList;
string DG_cpk = ddl.SelectedValue;
try
{
RadListBox rlb = (RadListBox)pageform.FindControl("listWho");
DataAccess sda = new DataAccess();
sda.RunSelectCmd("select cpk_users from users inner join DG_Users_Link DUL on users.CPK_USERS = DUL.Cfk_Users and DUL.DELFLAG=0 "
+ "inner join DistributionGroups DG on DUL.Cfk_DistributionGroups=DG.CPK_DistributionGroups and DG.delflag=0 "
+ "where users.DELFLAG=0 and DG.CPK_DistributionGroups=" + DG_cpk);
if (!sda.blNoRecords)
{
foreach (DataRow dr in sda.dtResult.Rows)
{
itemValue = dr["cpk_users"].ToString();
RadListBoxItem rlbi = rlb.FindItemByValue(itemValue);
rlbi.Selected = true;
}
}