Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Fredrik 89 posts 108 karma points
    Oct 19, 2010 @ 10:37
    Fredrik
    0

    Webservice problem Ajax autocompleteextender

    Hi.

    Ive run into a problem while creating a usercontrol using ajax autocompleteextender.

    I get no errors but I am unsure if my usercontrol finds the webservice which right now is set to:

    ServicePath="~/autocomplete.asmx"  and is placed in the same folder as my ascx usercontrol(Umbracoroot/usercontrols)

    Where should I place my webservice(autocomplete.asmx)?

    Anything else I need to consider?

  • Fredrik 89 posts 108 karma points
    Oct 19, 2010 @ 18:57
    Fredrik
    0

    I have removed the .asmx file and now try to run the Webmethod directly in the .ascx instead.

    It works in a ASP.net WebApplication Webform(.Aspx Web Form)

    [System.Web.Services.WebMethod]
            public static string[] GetNames(string prefixText, int count)
            {
                List<String> hits = new List<String>();
                SqlConnection conn = new SqlConnection();
                conn.ConnectionString = "Data Source=(local);Initial Catalog=umbracodb;Integrated Security=True";
                conn.Open();
                SqlCommand cmd = conn.CreateCommand();
                cmd.Parameters.Add("@Input", SqlDbType.VarChar, 50);
                cmd.Parameters["@Input"].Value = "%" + prefixText + "%";
                cmd.CommandText = "SELECT [Name] FROM [Product] WHERE [Name] like @Input";
                cmd.ExecuteNonQuery();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    hits.Add(reader["Name"].ToString());
                }
                conn.Close();
                conn.Dispose();
                return hits.ToArray();
            }

     

    I get no errors but no response from the textbox with autocompleteextender in a user control(.Ascx) on my umbraco site

    [System.Web.Services.WebMethod]
            public static string[] GetNames(string prefixText, int count)
            {
                List<String> hits = new List<String>();
                SqlConnection conn = new SqlConnection(GlobalSettings.DbDSN);
                conn.Open();
                SqlCommand cmd = conn.CreateCommand();
                cmd.Parameters.Add("@Input", SqlDbType.VarChar, 50);
                cmd.Parameters["@Input"].Value = "%"+prefixText+"%";
                cmd.CommandText = "SELECT [Name] FROM [Product] WHERE [Name] like @Input";
                cmd.ExecuteNonQuery();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    hits.Add(reader["Name"].ToString());
                }
                conn.Close();
                conn.Dispose();
                return hits.ToArray();
            }

    Bold marks the only difference in the code itself

    This aint a forum for AJAX extensions, I am aware of that. But I am curious since the code runs fine in a standard ASP.net WebApplication but not as an usercontrol exported to Umbraco

  • Rory 59 posts 84 karma points
    Jul 02, 2011 @ 18:35
    Rory
    0

    Hi, am having the same problem...did you ever get a solution?

    thanks

    Rory

  • pat 124 posts 346 karma points
    Jul 08, 2011 @ 11:11
    pat
    0

    I am facing for same problem, but this is not working, when I use pagemethod and just set servicemethod on ajax control , I cann see page automatically set to servicepath to page it selef but noting happen. I have added all Ajax dll files and folders with dll to website and build my usercontrol application and then copy that dll to.

    but this is not work. I tried to copy asmx file to root directory  of website and call that on autocompleteextender ServicePath=http://www.website/webservice1.asmx not working then try just service name without http.... how do i solve this problem.

    please give expert ideas.....

  • Rory 59 posts 84 karma points
    Jul 08, 2011 @ 12:27
    Rory
    0

    check you can call the webservice directly from the browser. If not, then debug that first. This is what fixed it for me.

    Rory

  • pat 124 posts 346 karma points
    Jul 08, 2011 @ 17:22
    pat
    0

    I can browse to webservice, show me the method . but i cannot test it "The test form is only available for requests from the local machine. "

    how did you call service path in ajax control

    as http:www.wesitename/webservice1.asmx or different?

     

    <asp:AutoCompleteExtenderID="AutoCompleteExtender1"runat="server"TargetControlID="txtdestinaion"

     

     

    ServicePath="http://www.mysitename.co.uk/DestAutoComplete.asmx"ServiceMethod="GetList" ....

     

     

  • pat 124 posts 346 karma points
    Aug 18, 2011 @ 10:12
    pat
    0

    I have to solve this problem please any one can help me on this. It seems umbraco does not like the webservice call from usercontrol. I have copy webservice to websie root folder and gave servicepath as url but still this is not working. anyone can help to sort use of autocomplete asp.net ajax control in mbraco usercontrol please .......

    any other solution would be ok too.

  • pat 124 posts 346 karma points
    Sep 21, 2011 @ 14:00
    pat
    0

    I have sorted this problem,  now my asp.net ajax work with webservice saved in root folder of the website and change config file according to the following article.

    http://msdn.microsoft.com/en-us/library/bb763183.aspx?ppud=4

Please Sign in or register to post replies

Write your reply to:

Draft