Hi,
I am using a radcombobox and populating it using webservice. However the combobox is not loaded when the page loads the first time. when i start typing the combobox gets loaded fine with the values. i want the combobox to contain top 100 rows when the page loads so that by just clicking on the dropdown arrow it can see the option with out typing anything in the box.
Please find my code below:-
<telerik:RadComboBox runat="server" ID="RadComboBox1" Width="300px" Height="550px" AllowCustomText="true" OnClientItemsRequesting="OnClientItemsRequesting"
EnableLoadOnDemand="true" ShowMoreResultsBox="true" EnableVirtualScrolling="true" MarkFirstMatch="true" ItemsPerRequest="100"
EnableAutomaticLoadOnDemand="true" AutoPostBack="true">
<WebServiceSettings Path="~/Controls/ManagerListService.asmx" Method="GetManagerNames" />
</telerik:RadComboBox>
javascript
function OnClientItemsRequesting(sender, eventArgs) {
var context = eventArgs.get_context();
}
web srevice code
<WebMethod()>
Public Function GetManagerNames(context As RadComboBoxContext) As RadComboBoxData
Dim data As DataTable = Employee.LineManagersForUser(context.Text)
Dim result As New List(Of RadComboBoxItemData)()
Dim dropDownData As New RadComboBoxData()
Dim itemOffset As Integer = context.NumberOfItems
Dim endOffset As Integer = Math.Min(itemOffset + ItemsPerRequest, data.Rows.Count)
dropDownData.EndOfItems = endOffset = data.Rows.Count
result = New List(Of RadComboBoxItemData)(endOffset - itemOffset)
For i As Integer = itemOffset To endOffset - 1
Dim itemData As New RadComboBoxItemData()
itemData.Text = data.Rows(i)("Name").ToString()
itemData.Value = data.Rows(i)("EmplID").ToString()
result.Add(itemData)
Next
dropDownData.Items = result.ToArray()
Return dropDownData
End Function
Thanks,
Vineet
I am using a radcombobox and populating it using webservice. However the combobox is not loaded when the page loads the first time. when i start typing the combobox gets loaded fine with the values. i want the combobox to contain top 100 rows when the page loads so that by just clicking on the dropdown arrow it can see the option with out typing anything in the box.
Please find my code below:-
<telerik:RadComboBox runat="server" ID="RadComboBox1" Width="300px" Height="550px" AllowCustomText="true" OnClientItemsRequesting="OnClientItemsRequesting"
EnableLoadOnDemand="true" ShowMoreResultsBox="true" EnableVirtualScrolling="true" MarkFirstMatch="true" ItemsPerRequest="100"
EnableAutomaticLoadOnDemand="true" AutoPostBack="true">
<WebServiceSettings Path="~/Controls/ManagerListService.asmx" Method="GetManagerNames" />
</telerik:RadComboBox>
javascript
function OnClientItemsRequesting(sender, eventArgs) {
var context = eventArgs.get_context();
}
web srevice code
<WebMethod()>
Public Function GetManagerNames(context As RadComboBoxContext) As RadComboBoxData
Dim data As DataTable = Employee.LineManagersForUser(context.Text)
Dim result As New List(Of RadComboBoxItemData)()
Dim dropDownData As New RadComboBoxData()
Dim itemOffset As Integer = context.NumberOfItems
Dim endOffset As Integer = Math.Min(itemOffset + ItemsPerRequest, data.Rows.Count)
dropDownData.EndOfItems = endOffset = data.Rows.Count
result = New List(Of RadComboBoxItemData)(endOffset - itemOffset)
For i As Integer = itemOffset To endOffset - 1
Dim itemData As New RadComboBoxItemData()
itemData.Text = data.Rows(i)("Name").ToString()
itemData.Value = data.Rows(i)("EmplID").ToString()
result.Add(itemData)
Next
dropDownData.Items = result.ToArray()
Return dropDownData
End Function
Thanks,
Vineet