http://demos.telerik.com/aspnet-ajax/combobox/examples/loadondemand/wcf/defaultcs.aspx
into an application Im putting together as a learning excercise.
Ive verified ( using a packet sniffer, and decoding the HTTP traffic) that the results from the services calls are being sent from the server to the client, however the results do not appear in the combobox.
The svc file looks like:
using
System;
using
System.Collections.Generic;
using
System.Data.Linq;
using
System.Linq;
using
System.Runtime.Serialization;
using
System.ServiceModel;
using
System.ServiceModel.Activation;
using
System.ServiceModel.Web;
using
System.Text;
using
System.Web.Services;
using
Telerik.Web.UI;
namespace
QUARK.webservices
{
[
ServiceContract(Namespace = "")]
[
AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class strange
{
[
OperationContract]
public RadComboBoxData LoadDataTemplates(RadComboBoxContext context)
{
RadComboBoxData result = new RadComboBoxData();
quarkDataContext quarkdb = new quarkDataContext();
var allTemplates = from DEVICE_TYPE in quarkdb.DEVICE_TYPEs
orderby DEVICE_TYPE.DESC
select new RadComboBoxItemData
{
Text = DEVICE_TYPE.DESC
};
string text = context.Text;
if (!String.IsNullOrEmpty(text))
{
allTemplates = allTemplates.Where(item => item.Text.StartsWith(text));
}
int numberOfItems = context.NumberOfItems;
var templates2 = allTemplates.Skip(numberOfItems).Take(10);
result.Items = templates2.ToArray();
int endOffset = numberOfItems + templates2.Count();
int totalCount = allTemplates.Count();
if (endOffset == totalCount)
result.EndOfItems =
true;
result.Message =
String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>",
endOffset, totalCount);
return result;
}
}
}
and my combobox in the aspx looks like:
<
telerik:RadComboBox ID="drp_hosttemplate" Runat="server"
Skin="Web20" Width="177px" EnableLoadOnDemand="True"
EnableVirtualScrolling="True" ShowMoreResultsBox="True"
EnableItemCaching="True" >
<WebServiceSettings Method="LoadDataTemplates" Path="webservices/strange.svc" />
<ExpandAnimation Type="InOutElastic" />
<CollapseAnimation Type="InOutElastic" />
</telerik:RadComboBox>