This is a migrated thread and some comments may be shown as answers.

Attempting to utilize ItemTemplate and WebService not working

8 Answers 262 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Andre' Hazelwood
Top achievements
Rank 1
Andre' Hazelwood asked on 01 Feb 2008, 06:06 PM
I have been attempting to use the new RadComboBox control with a custom ItemTemplate similar to the example that you provide.  I also am trying to get it to add additional results using a WebService (and potentially a WCF Service) to provide data.

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

Sort by
0
Andre' Hazelwood
Top achievements
Rank 1
answered on 01 Feb 2008, 06:08 PM
In the meantime, here is the ASPX code:

<%

@ 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();

}

}

}

0
Simon
Telerik team
answered on 04 Feb 2008, 05:21 PM
Hi Andre' Hazelwood,

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
0
Tom Jaspering
Top achievements
Rank 1
answered on 05 Mar 2008, 02:33 AM
I too am having this issue. Am I reading correctly that templated dropdowns can no longer use any sort of streaming functionality like ExternalCallbackPage or the new WebServiceSettings? This seems to represent a pretty significant loss of functionality between RadControls for ASP.Net and Prometheus. We make heavy use of templated dropdowns with ExternalCallbackPage. Some of them are quite large and the only way we could get acceptable performance was via this "Streaming" approach. Is this an issue that we can expect to be corrected in a future release or can you perhaps suggest another approach other than standard LoadOnDemand?
0
Simon
Telerik team
answered on 06 Mar 2008, 03:28 PM
Hello Tom Jaspering,

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
0
Kenneth
Top achievements
Rank 1
answered on 12 Jun 2008, 11:36 AM
Any news about this issue? ItemTemplate with a webservice?

It's a functionality we really need.

Regards
0
Simon
Telerik team
answered on 13 Jun 2008, 02:50 PM
Hi Kenneth,

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
0
Andreas Dahlén
Top achievements
Rank 1
answered on 15 Dec 2010, 12:53 PM
Old question, but I have the same problem now.
Are there any suggestions/solutoins on how to utilize template WebService?
0
Simon
Telerik team
answered on 16 Dec 2010, 04:27 PM
Hello Andreas Dahlén,

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
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
ComboBox
Asked by
Andre' Hazelwood
Top achievements
Rank 1
Answers by
Andre' Hazelwood
Top achievements
Rank 1
Simon
Telerik team
Tom Jaspering
Top achievements
Rank 1
Kenneth
Top achievements
Rank 1
Andreas Dahlén
Top achievements
Rank 1
Share this question
or