Bug in combobox online Demo

2 posts, 0 answers
  1. Stanley
    Stanley avatar
    13 posts
    Member since:
    Jun 2011

    Posted 22 Jul 2011 Link to this post

    Hi all,

    According your demo on usibng web services to load data on demand:


    if I remove the 'static' code from the method in the code behind CS page I get the error :

    "The server method has failed' as a popup box.

    Here is my code behind:

    public const int ItemsPerRequest = 10;
           public  RadComboBoxData GetDealNumbers(RadComboBoxContext context)
               DataTable data = GetData(context.Text);
               RadComboBoxData comboData = new RadComboBoxData();
               int itemOffset = context.NumberOfItems;
               int endOffset = Math.Min(itemOffset + ItemsPerRequest, data.Rows.Count);
               comboData.EndOfItems = endOffset == data.Rows.Count;
               List<RadComboBoxItemData> result = new List<RadComboBoxItemData>(endOffset - itemOffset);
               for (int i = itemOffset; i < endOffset; i++)
                   RadComboBoxItemData itemData = new RadComboBoxItemData();
                   itemData.Text = data.Rows[i]["DealNo"].ToString();
                   itemData.Value = data.Rows[i]["DealNo"].ToString();
               comboData.Message = GetStatusMessage(endOffset, data.Rows.Count);
               comboData.Items = result.ToArray();
               return comboData;
           public  DataTable GetData(string text)
               SqlDataAdapter adapter = new SqlDataAdapter("SELECT new_name as 'DealNo' from new_dealtracking WHERE new_name  LIKE @text + '%'", Properties.Settings.Default.MSCRMConnectionString);
               adapter.SelectCommand.Parameters.AddWithValue("@text", text);
               DataTable data = new DataTable();
               return data;
           private  string GetStatusMessage(int offset, int total)
               if (total <= 0)
                   return "No matches";
               return String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", offset, total);

    My aspx code is:

    <telerik:RadComboBox ID="RadComboBox4" runat="server" Width="157px" Height="150px"
                   EmptyMessage="Select a Deal" EnableLoadOnDemand="true" ShowMoreResultsBox="true"
                   <WebServiceSettings Method="GetDealNumbers" Path="Custom_DealUI.aspx" />

    Why is this the case??
  2. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 22 Jul 2011 Link to this post

    Hello Stanley,

    The reason it doesn't work when you remove the static qualifier on the method is because you're using the Page Methods technique, not a Web Service, even though you set it up in the WebServiceSettings tag.

    The real Web Service example is the third one from the bottom, which you'll notice from the .asmx extension used in the Path.

    I hope that helps.
Back to Top