Attempting to utilize ItemTemplate and WebService not working

9 posts, 0 answers
  1. Andre' Hazelwood
    Andre' Hazelwood avatar
    12 posts
    Member since:
    Oct 2005

    Posted 01 Feb 2008 Link to this post

    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'
  2. Andre' Hazelwood
    Andre' Hazelwood avatar
    12 posts
    Member since:
    Oct 2005

    Posted 01 Feb 2008 Link to this post

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

    }

    }

    }

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 04 Feb 2008 Link to this post

    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
  5. Tom Jaspering
    Tom Jaspering avatar
    34 posts
    Member since:
    May 2006

    Posted 04 Mar 2008 Link to this post

    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?
  6. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 06 Mar 2008 Link to this post

    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
  7. Kenneth
    Kenneth avatar
    29 posts
    Member since:
    Sep 2004

    Posted 12 Jun 2008 Link to this post

    Any news about this issue? ItemTemplate with a webservice?

    It's a functionality we really need.

    Regards
  8. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 13 Jun 2008 Link to this post

    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
  9. Andreas Dahlén
    Andreas Dahlén avatar
    16 posts
    Member since:
    Mar 2010

    Posted 15 Dec 2010 Link to this post

    Old question, but I have the same problem now.
    Are there any suggestions/solutoins on how to utilize template WebService?
  10. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 16 Dec 2010 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017