c# - The same autocomplete works in one solution, but not in the other one -
I have tried everything and it is driving me crazy. I gave an autocomplete solution that works in a solution , But when I export it (copy and paste) in my main solution it no longer works and I get the following error: "Unable to retrieve the property length of the undefined or zero" reference. It can not be jquery version and stuff, as it works in other solutions.
aspx: CodiceFiscale.aspx
& lt; Link rel = "stylesheet" href = "http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/them/redmond/jquery-ui.css" /> & Lt; Script src = "http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.8.0.js" & gt; & Lt; / Script & gt; & Lt; Script src = "http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.22/jquery-ui.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; $ (Function () {$ ("# MainContent_provatxt"). Autocomplete ({source: function (request, response) {var param = {cityName: $ ('# MainContent_provatxt'). Val ()} $ .ajax ({ Url: "CodiceFiscale.aspx / GetCities", data: JSON.stringify (param), Data type: "json", type: "POST", contentType: "application / json; charset = utf-8", data filter: function (Data) {return data;}, success: function (data) {response ($ .max (data.d, function (item) {return {value: item}})}}, error: function (XMLHttpRequest, textStatus, ErrorThrown) {alert (textstats);}})}}, minnumber: 3});});
& asp: textbox id = "provatxt" runat = "server" & gt; & Lt; / Asp: textbox & gt; Yes, BTW Yes, I want to get the elements of # main content_ because the text box in the browser is different from the ID project, but it works fine in other solutions. Behind the code: CodiceFiscale.aspx.cs [WebMethod] Public static list & lt; String & gt; GetCities (string city name) {list & lt; String & gt; City = new list & lt; String & gt; (); String query = string.format ("select nome_comune comuni where nome_comune '% {0}%'", cityName); (MySqlConnection conn = new MySqlConnection ("server = localhost; database = servizi; Uid = root; Pwd = root;")) {{MySqlCommand cmd = new MySqlCommand (query, conn)) {conn.Open (); MySqlDataReader Reader = cmd.ExecuteReader (); While (reader.Read ()) {City.Add (reader.GetString (0)); }}} Return city; }
You control your client ID and ID with ClientIDMode to predict and can do (). What does the server return to your success
function?
Comments
Post a Comment