I need to move selected items from a RadList box to two other listboxes depending upon which button a user clicks. I cannot use the built-in TransferToID because that will only handle one source and one target.
The RadListBox get populated with a databind on the first load ...
if (!Page.IsPostBack)
{
RadListBox1.DataSource = dt;
RadListBox1.DataValueField = "UserID";
RadListBox1.DataTextField ="FullName";
RadListBox1.DataBind();
}
When I try accessing the selected items during a button-click event I do NOT get any hits ... nothing shows up in the SelectedItems collection of the RadListBox. How can I solve this problem ?
Thanks.
protected void btnFindSelected_Click(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder();
foreach (RadListBoxItem item in RadListBox1.SelectedItems)
{
sb.Append(item.Text);
// THIS IS ALWAYS EMPTY NO MATTER HOW MANY ITEMS I SEE ON THE PAGE THAT AREA SELECTED
}
for (int i = 0; i < RadListBox1.Items.Count; i++)
{
if (RadListBox1.Items[i].Selected)
{
sb.Append(RadListBox1.Items[i].Text);
}
}
}string thisList = sb.ToString();
// THIS IS ALWAYS EMPTY NO MATTER HOW MANY ITEMS I SEE ON THE PAGE THAT ARE SELECTED
NOTE: I was able to get a similar version of this to work successfully in a new project ... so there must be something else affecting the original that I haven't spotted.