I have a sample that I can post. (Please email me to get the zip file to append).
Thanks,
Andre'
8 Answers, 1 is accepted
<%
@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Telerik.Test._Default" %>
<%
@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<%
@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml" >
<
head id="Head1" runat="server">
<title>Untitled Page</title>
</
head>
<
body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="~/Services/UserSettings.asmx" />
</Services>
</asp:ScriptManager>
<div>
<telerik:RadComboBox ID="lstClients" runat="server"
Skin="Vista" Font-Size="10px" Font-Names="Arial, Tahoma, sans-serif"
MarkFirstMatch="true" HighlightTemplatedItems="true" ShowToggleImage="true"
AllowCustomText="false" EnableLoadOnDemand="false"
ShowMoreResultsBox="True">
<ItemTemplate>
<div>
<img src="/images/Company.gif" alt="" />
Project: <%
# DataBinder.Eval( Container, "Attributes['DisplayName']" ) %>
</div>
</ItemTemplate>
<Items>
<telerik:RadComboBoxItem
Text="* Select a Client"
Value="-1"
DisplayName="* Select a Client"
/>
<telerik:RadComboBoxItem
Text="Client 0"
Value="0"
DisplayName="Client 0"
/>
</Items>
<WebServiceSettings Path="~/services/UserSettings.asmx" Method="GetProjectList" />
</telerik:RadComboBox>
</div>
</form>
</
body>
</
html>
The Web Service is as follows:
using
System;
using
System.Collections;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Linq;
using
System.Web;
using
System.Web.Script.Services;
using
System.Web.Services;
using
System.Web.Services.Protocols;
using
System.Xml.Linq;
using
Telerik.Web.UI;
namespace
Telerik.Test.Services
{
/// <summary>
/// Summary description for UserSettings
/// </summary>
[
WebService( Namespace = "http://tempuri.org/" )]
[
WebServiceBinding( ConformsTo = WsiProfiles.BasicProfile1_1 )]
[
ToolboxItem( false )]
[
ScriptService]
public class UserSettings : System.Web.Services.WebService
{
[
WebMethod]
public string HelloWorld() {
return "Hello World";
}
[
WebMethod]
[
ScriptMethod]
public RadComboBoxItemData[] GetProjectList( object objectContext ) {
List<RadComboBoxItemData> projectList = new List<RadComboBoxItemData>();
RadComboBoxItemData item = new RadComboBoxItemData();
item.Text =
"Project 1";
item.Value =
"35";
projectList.Add( item );
RadComboBoxItemData item2 = new RadComboBoxItemData();
item2.Text =
"Project 2";
item2.Value =
"37";
projectList.Add( item2 );
return projectList.ToArray();
}
}
}
Working with ItemTemplates and using DataBinder.Eval requires the RadComboBox to be bound each time an item is added (RadComboBox.DataBind()). When populating the control via a WebService this could not be done.
Please try using the standard Load-On-Demand approach to accomplish this.
Sincerely yours,
Simeon
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Taking into consideration the current implementation of RadComboBox, this task could not be accomplished.
However, we have logged this functionality as a future feature, yet we have not planned when exactly it would be introduced.
Thank you for your understanding.
Best wishes,
Simon
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
It's a functionality we really need.
Regards
It would be great if RadComboBox supports Templates for Items created on the client (including those loaded from a Web Service). However, this is not an easy task. Let me briefly explain.
Templated Items' HTML is built at the server before it is finally rendered. This is required because the Template definition is available only at the server and Items are built using this definition.
At the moment, when an Item is created at the client, there is no way of determining how the Item should be represented.
We will continue our research on the matter to find the best possible implementation of the feature. I cannot, however, set a time frame at this time.
Sincerely yours,
Simon
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Are there any suggestions/solutoins on how to utilize template WebService?
Yes, please see this blog post for more information. As an alternative to using ASP.NET AJAX Templates you can use jQuery Templates. The rest of the approach is the same.
Greetings,
Simon
the Telerik team