RadAutoCompleteBox works on localhost but not when published.

14 posts, 0 answers
  1. John
    John avatar
    15 posts
    Member since:
    Sep 2012

    Posted 16 Oct 2012 Link to this post

    I have a project with RadAutoCompleteBox and every thing works fine on my localhost, but when I upload it the page doesn't crash but the drop down doesn't appear at all but yet it works fine on my computer.

    I have the RadAutoCompleteBox binded to a web service.

    When I go to the web service page online I get the following error. 

    Cannot serialize member Telerik.Web.UI.AutoCompleteBoxData.Context of type System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], because it implements IDictionary.


    Here is my code in the web service.
    using ClassLibrary;
    // uses the class library
     
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Telerik.Web.UI.AutoCompleteBox;
    using System.Web.Services;
    using Telerik.Web.UI;
    using System.Data;
    using System.Data.SqlClient;
    using System.Configuration;
     
     
    //using System.Collections;
    //using System.Runtime.Serialization;
    //using System.Runtime.Serialization.Formatters.Binary;
     
     
    namespace ReportsViewer.Services
    {
        /// <summary>
        /// Web service for telerik autocompletebox
        /// </summary>
        [WebService(Namespace = "http://tempuri.org/")]
        [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
        [System.ComponentModel.ToolboxItem(false)]
        // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
        [System.Web.Script.Services.ScriptService]
         
        public class StaffWebService : System.Web.Services.WebService
        {
            string QueryData {get; set;}
            string AcademicYear { get; set; }
     
            [WebMethod(EnableSession = true)]
     
            public AutoCompleteBoxData GetStaffNames(object context)
            {
                //Orignal code
                //QueryData = context["Text"].ToString();
                //var AcademicYear = Session["AcademicYear"];
     
                //Testing code
                string QueryData = ((IDictionary<string, object>)context)["Text"].ToString();
                var AcademicYear = Session["AcademicYear"];
     
                    using (SqlConnection cn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["Connect"].ConnectionString))
                    {
                    cn.Open();
                    using (SqlCommand cm = cn.CreateCommand())
                    {
                        cm.CommandText = "sql stuff";
                         
                        cm.Parameters.AddWithValue("@QueryData", QueryData);
                        cm.Parameters.AddWithValue("@AcademicPeriod", AcademicYear);
                         
                        using (SqlDataAdapter objAdpt = new SqlDataAdapter())
                        {
                            objAdpt.SelectCommand = cm;
     
                            using (DataTable dt = new DataTable())
                            {
                                objAdpt.Fill(dt);
                                dt.DefaultView.Sort = "Name";
     
                                List<AutoCompleteBoxItemData> result = new List<AutoCompleteBoxItemData>();
                                AutoCompleteBoxData dropDownData = new AutoCompleteBoxData();
     
                                result = new List<AutoCompleteBoxItemData>();
     
                                for (int i = 0; i < dt.Rows.Count; i++)
                                {
                                    AutoCompleteBoxItemData itemData = new AutoCompleteBoxItemData();
                                    itemData.Text = dt.Rows[i]["Name"].ToString();
                                    itemData.Value = dt.Rows[i]["WINDOWS_USER_ID"].ToString();
     
                                    result.Add(itemData);
                                }
     
                                dropDownData.Items = result.ToArray();
                                return dropDownData;
          
                            }
                                 
                        }
                             
                         
                    }
     
                }
            }
             
        }//end of class
    }//end of namespace

    Cheers

    John Moore
  2. John
    John avatar
    15 posts
    Member since:
    Sep 2012

    Posted 17 Oct 2012 Link to this post

    When I have the following.

    public AutoCompleteBoxData GetStaffNames(object context)

     

    It works fine on the aspx page and the drop down appears but when I go to the web service page it shows
    The type Telerik.Web.UI.RadAutoCompleteContext is not supported because it implements IDictionary. 
    But it works.

    When I make it. 
    public static AutoCompleteBoxData GetStaffNames(object context)

    The web service is fixed and no errors but when I run the axpx page no drop down appears.

    This problem is doing my head in, any help would be gladly appreciated.
     
    Thanks

    John Moore

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. John
    John avatar
    15 posts
    Member since:
    Sep 2012

    Posted 18 Oct 2012 Link to this post

    After 5 days of this problem doing my head in and have tried everything I went to the telerik tab in visual studio and went to  
    RadControls for asp.net AJAX and went to the upgrade wizard because I was bored.

    Published the site and guess what it worked on webhost even thou if I go to the web service directly it doesn't work and says about Idictionary.

    The type Telerik.Web.UI.RadAutoCompleteContext is not supported because it implements IDictionary.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.NotSupportedException: The type Telerik.Web.UI.RadAutoCompleteContext is not supported because it implements IDictionary.

    Source Error:
    [NotSupportedException: The type Telerik.Web.UI.RadAutoCompleteContext is not supported because it implements IDictionary.]
       System.Xml.Serialization.TypeScope.GetDefaultIndexer(Type type, String memberInfo) +5529598
       System.Xml.Serialization.TypeScope.ImportTypeDesc(Type type, MemberInfo memberInfo, Boolean directReference) +885
       System.Xml.Serialization.TypeScope.GetTypeDesc(Type type, MemberInfo source, Boolean directReference, Boolean throwOnError) +153
       System.Xml.Serialization.XmlReflectionImporter.ImportMemberMapping(XmlReflectionMember xmlReflectionMember, String ns, XmlReflectionMember[] xmlReflectionMembers, Boolean rpc, Boolean openModel, RecursionLimiter limiter) +73
       System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlReflectionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement, Boolean rpc, Boolean openModel, RecursionLimiter limiter) +286



    This must be a major problem with this control connected to a webservice.
  5. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 18 Oct 2012 Link to this post

    Hello John,

    The issue that you describe is quite strange.
    Populating the RadAutoCompleteBox with data via WebService works properly on our online demo here.

    I simplified your web service implementation and prepared a very basic sample – could you please download it and test it on your side?

    Maybe there is something specific in your project (or implementation) that causes the issue?
    I believe that a working sample on your side will help you to find it.

    Regards,
    Kalina
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  6. John
    John avatar
    15 posts
    Member since:
    Sep 2012

    Posted 19 Oct 2012 Link to this post

    I downloaded you files and created a new project.

    When I run it

    Error Message.

    Microsoft JScript runtime error: Sys.ArgumentUndefinedException: Value cannot be undefined.
    Parameter name: baseType

    Line number 786 - In

     
    MicrosoftAjax.debug.js
    Version: 4.0.0.0

    FileVersion: 4.0.30319.17929


    At the the throw Error.argumentUndefind('baseType');
    if ((arguments.length > 1) && (typeof(baseType) === 'undefined')) throw Error.argumentUndefined('baseType');

    I am using visual studio 2010 - Version 10.0.40219.1 sp1Rel
    .NET Framework version 4.5.50709 sp1 rel
    Windows 7

  7. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 23 Oct 2012 Link to this post

    Hello John,

    The sample web site that I have provided you works properly on my side - please take a look at this demonstration video.
    Did you change the sample web site before running it?
    Where did you receive the error - on your development machine or on the server where you publish the website?

    Regards,
    Kalina
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  8. Ganapathy
    Ganapathy avatar
    12 posts
    Member since:
    Aug 2012

    Posted 11 Oct 2013 Link to this post

    Hi Team,

    This sample is working in my system.

    Thank You
    Regards
    Ganapathy (Gunny)
  9. Tomasz
    Tomasz avatar
    20 posts
    Member since:
    Apr 2012

    Posted 15 Jan 2014 Link to this post

    I have the same issue.
    On my dev machine it works fine but after publishing to my hosting the control doesn't work.
    I'm using SQL Data Source, I've EF and OpenAccess also with the same results...

    No errors, no nothing...
  10. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 20 Jan 2014 Link to this post

    Hi Tomasz,

    We are not aware of such known issue in the current version of the control. Would you please share the exact code connected with RadAutoCompleteBox that you are using so we could inspect it and be more helpful?

    Regards,
    Plamen
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  11. Tomasz
    Tomasz avatar
    20 posts
    Member since:
    Apr 2012

    Posted 20 Jan 2014 Link to this post

    Your suport is already working on it because I've provided a sample solution which was admited to have a bug in this scenario :)
  12. Nessi
    Nessi avatar
    6 posts
    Member since:
    Jun 2015

    Posted 31 Aug 2015 Link to this post

    Any update on this issue?

    I have the same effect, getting the error about the IDoctionary when accessing the web service.

  13. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 02 Sep 2015 Link to this post

    Hi,

    We are not aware of such issue in the latest version of the controls. You can refer to this online demo where the scenario is working correctly. If you still observe the issue please elaborate the exact code that should be used to replicate it at our side.

    Regards,
    Plamen
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  14. Anoosh
    Anoosh avatar
    1 posts
    Member since:
    May 2014

    Posted 29 Nov in reply to Plamen Link to this post

    I am having the same issue using Telerik build: 2016.3.1027 (Dev)

    Cannot serialize member Telerik.Web.UI.AutoCompleteBoxData.Context of type System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], because it implements IDictionary.

    Can someone help?

  15. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 01 Dec Link to this post

    Hi,

    I have tested a scenario once again with the sample page that was attached in the answer by Kalina on 18-Oct-2012 5:26:54 PM and it still worked correctly at my side.

    Regards,
    Plamen
    Telerik by Progress
    Telerik UI for ASP.NET AJAX is ready for Visual Studio 2017 RC! Learn more.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017