Hello, i have a radcombobox that load filtered data using Web service. The aspx page is like this :
<telerik:RadComboBox runat="server" ID="rcbCustomer" Width="350px"EmptyMessage="Select Customer" Visible="true" Filter="Contains" MinFilterLength="3"EnableAutomaticLoadOnDemand="true" EnableLoadOnDemand="true"AllowCustomText="true" Height="100px" ShowMoreResultsBox="true"OnItemsRequested="rcbCustomer_ItemsRequested"EnableVirtualScrolling="true" EnableViewState="true"OnSelectedIndexChanged="rcbCustomer_SelectedIndexChanged" AutoPostBack="true" CausesValidation="false"><WebServiceSettings Method="GetCustomerName" Path="SalesOrderWebService.asmx"></WebServiceSettings</telerik:RadComboBox>
and on my .asmx.cs is like this :
/// <summary> /// Summary description for SalesOrderWebService /// </summary> [WebService(Namespace = "SO.Web.UI")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService] public class SalesOrderWebService : System.Web.Services.WebService { [WebMethod] public RadComboBoxData GetCustomerName(RadComboBoxContext context) { List<RadComboBoxItemData> result = new List<RadComboBoxItemData>(context.NumberOfItems); RadComboBoxData comboData = new RadComboBoxData(); CustomerCollection colCustomer = new CustomerCollection(); colCustomer.ListAutoSuggest(context.Text); if (colCustomer.Count>0) { int itemsPerRequest = 10; int itemOffset = context.NumberOfItems; int endOffset = itemOffset + itemsPerRequest; if (endOffset > colCustomer.Count) { endOffset = colCustomer.Count; } if (endOffset == colCustomer.Count) { comboData.EndOfItems = true; } else { comboData.EndOfItems = false; } result = new List<RadComboBoxItemData>(endOffset - itemOffset); for (int i=0;i<=colCustomer.Count-1;i++) { RadComboBoxItemData itemData = new RadComboBoxItemData(); itemData.Attributes.Add("CompanyID", colCustomer[i].CustomerId); itemData.Attributes.Add("CompanyName", colCustomer[i].CustomerName); itemData.Value = colCustomer[i].CustomerId.ToString(); itemData.Text = colCustomer[i].CustomerName; result.Add(itemData); } comboData.Message = String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset.ToString(), colCustomer.Count.ToString()); } else { comboData.Message = "No matches"; } comboData.Items = result.ToArray(); return comboData; } }
When i try to debug on page load after i select an item on rcbCustomer it always show as null.
What should i do to fix this ?
I'm using telerik.web.ui version 2016.3.1027.45.
Thank you in advance.