Hi guys,
I have a RadComboBox as follows
Which is inside a Load on demand RadPageView (incase that is relevant).
The ComboBox works fine for getting and matching values (names in this case) however in the SelectedIndexChanged my RadComboBox.SelectedItem is null, RadComboBox.Items.Count = 0. See below
Please note in the OnSelectedIndexChanged it is all commented out but the comments beside it tell you what happens.
I need it to have a SelectedItem so that i can access the Attributes i need to set.
Thanks in advance,
Pete
I have a RadComboBox as follows
<radcontrol:RadComboBox ID="MessageRecepientsSelectorComboBox" runat="server" EnableLoadOnDemand="true" |
LoadingMessage="Loading..." EmptyMessage="Please enter recepient(s) for the message..." |
OnItemsRequested="MessageRecepientsSelectorComboBox_OnItemsRequested" Width="450" ShowDropDownOnTextboxClick="false" |
Filter="StartsWith" OnSelectedIndexChanged="MessageRecepientsSelectorComboBox_OnSelectedIndexChanged" |
AutoPostBack="true" EnableItemCaching="true"></radcontrol:RadComboBox> |
Which is inside a Load on demand RadPageView (incase that is relevant).
The ComboBox works fine for getting and matching values (names in this case) however in the SelectedIndexChanged my RadComboBox.SelectedItem is null, RadComboBox.Items.Count = 0. See below
protected void MessageRecepientsSelectorComboBox_OnItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e) |
{ |
RadComboBox recepientSelectorComboBox = (RadComboBox)sender; |
if (!e.Text.Equals("") && e.Text.Length >= 1) |
{ |
List<Controls_RecepientsSelectorAJAXDropDownResult> potentialRecepients = MemberContactStaticRepository.GetRecepientsForAJAXSelector(53, e.Text); |
RadComboBoxItem currentItem = new RadComboBoxItem(); //stop re initialising var in loop |
for(int i = 0;i < potentialRecepients.Count();i++) |
{ |
currentItem = new RadComboBoxItem(potentialRecepients[i].UserName, potentialRecepients[i].UserID.ToString()); |
//currentItem.Attributes["ContactType"] = "User"; |
recepientSelectorComboBox.Items.Add(currentItem); |
} |
} |
} |
protected void MessageRecepientsSelectorComboBox_OnSelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) |
{ |
RadComboBox recepientBox = (RadComboBox)sender; |
//RadComboBoxItem selectedItem = MessageRecepientsSelectorComboBox.FindItemByValue(e.Value); //finds nothing == null |
//MessageRecepientsSelectorComboBox.Items.Count; // is 0 |
//MessageRecepientsSelectorComboBox.SelectedIndex;//returns -1 |
} |
Please note in the OnSelectedIndexChanged it is all commented out but the comments beside it tell you what happens.
I need it to have a SelectedItem so that i can access the Attributes i need to set.
Thanks in advance,
Pete