Hi.
As stated in the title, the position keeps resetting to the 1st element in the combobox as soon as new data is added to the combobox. Below is the itemrequested code I use.
Any help will be greatly appreciated.
Regards
As stated in the title, the position keeps resetting to the 1st element in the combobox as soon as new data is added to the combobox. Below is the itemrequested code I use.
Protected
Sub
cboInstrument_ItemsRequested(
ByVal
sender
As
Object
,
ByVal
e
As
RadComboBoxItemsRequestedEventArgs)
Try
Dim
oSender
As
Telerik.Web.UI.RadComboBox =
DirectCast
(sender, Telerik.Web.UI.RadComboBox)
oSender.DataValueField =
"Name"
oSender.DataTextField =
"Name"
Dim
data
As
List(Of Instrument)
If
Not
String
.IsNullOrWhiteSpace(ExchangeComboBox.SelectedValue)
Then
data = GetData(ExchangeComboBox.SelectedValue, e.Text,
False
)
Dim
itemOffset
As
Integer
= e.NumberOfItems
Dim
endOffset
As
Integer
= Math.Min(itemOffset + ItemsPerRequest, data.Count)
'e.EndOfItems = endOffset = IIf(data.Count = 1, 0, data.Count)
e.EndOfItems = endOffset = data.Count
For
i
As
Integer
= itemOffset
To
endOffset - 1
oSender.Items.Add(
New
RadComboBoxItem(
String
.Format(
"{0} - {1}"
, data(i).Symbol, data(i).Name), data(i).ExchangeSymbolKey))
Next
e.Message = GetStatusMessage(endOffset, data.Count)
Else
Dim
endOffset
As
Integer
= 0
oSender.Items.Add(
New
RadComboBoxItem(
"Select an Exchange"
,
Nothing
))
e.Message = GetStatusMessage(endOffset, 0)
End
If
Catch
exc
As
Exception
ProcessModuleLoadException(
Me
, exc)
End
Try
End
Sub
Any help will be greatly appreciated.
Regards