This is a migrated thread and some comments may be shown as answers.
Multicolumn combo on clientside webservice call
1 Answer 20 Views
This is a migrated thread and some comments may be shown as answers.
Craig
Top achievements
Rank 1
Craig asked on 18 Oct 2012, 04:36 PM
i am trying to get a multicolumn combo to populate but cannot get it to display correctly

the combo is as follows:-

<telerik:RadComboBox ID="comboBoxBoard" runat="server" Filter="Contains" EmptyMessage="Boarding at"
    Height="150px" Width="250px" EnableLoadOnDemand="true" ShowMoreResultsBox="true"
    Font-Bold="true" Font-Size="120%" Font-Italic="false" CssClass="CustomRadComboxCssClass"
    Skin="50pxOffice2007" EnableEmbeddedSkins="false" ItemRequestTimeout="500" EnableVirtualScrolling="true"
    MarkFirstMatch="true" AllowCustomText="false" OnClientItemsRequesting="OnClientItemsRequesting_DubBus_Board"  >
    <WebServiceSettings Method="GetStopDataByRouteTest" Path="~/Templates/public/RoutePlannerService/RTPIWebServiceProxy.asmx"  />
    <HeaderTemplate>
        <ul>
            <li class="col1">Value</li>
            <li class="col2">No</li>
            <li class="col3">Address</li>
            <li class="col4">Location</li>
            <li class="col5">Stage</li>
        </ul>
    </HeaderTemplate>
    <ItemTemplate>
        <li class="col1">
            <%# DataBinder.Eval(Container, "Value")%>
        <li class="col2">
            <%# DataBinder.Eval(Container, "Text")%>
        <li class="col3">
            <%# DataBinder.Eval(Container, "Attributes['Address']")%>
        <li class="col4">
            <%# DataBinder.Eval(Container, "Attributes['Location']")%>
        <li class="col5">
            <%# DataBinder.Eval(Container, "Attributes['Stage']")%>
    </ItemTemplate>
</telerik:RadComboBox>



then the webservice call looks like this....

[WebMethod] // Cached for 24 hours
 public RadComboBoxData GetStopDataByRouteTest(RadComboBoxContext context)
 {
     //string route = context["Text"].ToString();
     //string direction = context["Direction"].ToString();
     //string numberOfItems = context["NumberOfItems"].ToString();
 
     string route = "1";
     string direction = "I";
     string numberOfItems = "0";
 
     try
     {
 
         RadComboBoxData comboData = new RadComboBoxData();
 
         var dtBoarding = GetStopByRouteAndDirection(route, direction);
 
 
         if (dtBoarding.Rows.Count > 0)
         {
 
             int itemsCount;
             int.TryParse(numberOfItems, out itemsCount);
 
             int itemOffset = itemsCount;
             int endOffset = Math.Min(itemOffset + ITEMS_PER_REQUEST, dtBoarding.Rows.Count);
             comboData.EndOfItems = endOffset == dtBoarding.Rows.Count;
 
             List<RadComboBoxItemData> result = new List<RadComboBoxItemData>(endOffset - itemOffset);
             foreach (DataRow dataRow in dtBoarding.Rows)
             {
 
                 RadComboBoxItemData itemData = new RadComboBoxItemData();
 
                 string stopNumber = dataRow["StopNumber"].ToString();
                 string address = dataRow["Address"].ToString();
                 string location = dataRow["Location"].ToString();
                 string stage = (dataRow["StageNumber"].ToString() != string.Empty ? dataRow["StageNumber"].ToString() : "");
 
                 itemData.Value = stopNumber;
                 itemData.Text = stopNumber;
                 itemData.Attributes.Add("Address", address);
                 itemData.Attributes.Add("Location", location);
                 itemData.Attributes.Add("Stage", stage);
                 result.Add(itemData);
             }
 
             comboData.Message = GetStatusMessage(endOffset, dtBoarding.Rows.Count);
             comboData.Items = result.ToArray();
 
         }
 
         if (comboData.Items == null)
             comboData.Items = new RadComboBoxItemData[0];
 
         return comboData;
     }
     catch (Exception ex)
     {
         return null;
     }
 
 }


running an old version of the controls:- v2.0.50727


Any help is greatly appreciated

Cheers,
Craig



1 Answer, 1 is accepted

Sort by
0
Craig
Top achievements
Rank 1
answered on 18 Oct 2012, 05:18 PM
well looks as if it aint possible to use templates with webservice calls :(

http://www.telerik.com/community/forums/aspnet-ajax/combobox/radcombobox-loadondemand-pagemethod-using-multi-column-and-attributes.aspx
Asked by
Craig
Top achievements
Rank 1
Answers by
Craig
Top achievements
Rank 1
Share this question
or