AJAX :: Master Page - Web Service - Characters On Textbox Doesn't Trigger Autocomplete
Sep 16, 2010
I have a text box and ajax autocomplete control extender in my Master Page that it is not working at all. When I type some characters on the text box it doesn't trigger the autocomplete. I have a web service that contains the function code. I est my code on a single Web Page (No Master Page) and it works perfectly. Also, it works fine if I include the text box and the extender on the Content Page instead of on the Master Page. It is important to keep the text box in the Master Page for me. I am using Visual Studio 2008 and ASP 3.5. MASTER PAGE.
I got a aspx page using a master page. In the aspx page, i got multiple Content section: [Code]....
What I was trying to do is to perform a post back on Content Id "Content2" with a event trigger by both of the drop down list. The problem here is the drop down list is inside "Content 1".The error I got is: [Code]....
I have an updatepanel in masterpage and information on a repeater within the panel. I want to update this information from the content page, when a user clicks a button in the content page.
[code]....
I tried this but since button control is in the content page compiler can't find the control.
public class WebService : System.Web.Services.WebService { MySql.Data.MySqlClient.MySqlCommand cmd = new MySqlCommand(); MySql.Data.MySqlClient.MySqlConnection con = new MySqlConnection(); //MySqlDataAdapter da = new MySqlDataAdapter(); MySqlDataReader dr; public WebService () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public string[] GetCountryInfo(string prefixText) { int count = 10; string sql = "Select * from tbl_patientmaster Where P_NAME like '" + @prefixText + "%'"; con.ConnectionString = System.Configuration.ConfigurationManager.AppSettings["HMSDBConnectionString"].ToString(); con.Open(); MySql.Data.MySqlClient.MySqlDataAdapter da = new MySql.Data.MySqlClient.MySqlDataAdapter(sql, con); da.SelectCommand.Parameters.Add("@prefixText", MySql.Data.MySqlClient.MySqlDbType.VarChar, 50).Value = prefixText + "%"; System.Data.DataTable dt = new System.Data.DataTable(); da.Fill(dt); string[] items = new string[dt.Rows.Count]; int i = 0; foreach (System.Data.DataRow dr in dt.Rows) { items.SetValue(dr["P_NAME"].ToString(), i); i++; } return items; }
I have a small problem I am getting with the Autocomplete in my asp page, It uses a sql 'LIKE' query to find results from the database but after I type more than 3 Characters the autocomplete results dont filter any further even though there are results, I have tested the query seperatly and I works fine and as I said also works fine for the first 3 characters..
I'm new here and I need some help to use the AutoComplete Extender. I just have a default.aspx with a textbox extended with an AutoComplete. My Web Service calls a SQL Data Base thru Linq and return some account names.When I execute the WEB SERVICE and manually insert the parameters, it works! But when I execute the default.aspx, nothing happens. I really apreciate your help! See the CODES listed below:
See the Web Service code below:
[Code]....
Now, the code on DEFAULT.ASPX
[Code]....
I tried put the files in a remote SERVER, and I got the following error (in LOCALHOST I don't see that error):
Configuration Error Server Error in '/PC' Application. Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.
Source Error:
[Code]....
Line 8: <configuration> Line 9: <system.web> Line 10: <compilation debug="false" strict="false" explicit="true" targetFramework="4.0" /> Line 11: </system.web> Line 12: Source File: e:homeuysoftWebweb.config Line: 10 Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.4028
I have an UpdatePanel on the page which I'd like to trigger using javascript.First of all my code perfectly works if it's in a website not being inheriting from a masterpage. Now when you put exactly the same code into a website which inherits from a masterpage, the UpdatePanel wouldn't get fired anymore.
I'm going on my 3rd day trying to get my Ajax AutoComplete textbox to call my web method. Based on my google searches, I'm not alone. I suspect the problem has something to do with the ServicePath property on the extender, although I'm not sure. My web service is at the same level, on the same server as my test web page. I'm not sure exactly what should go into the ServicePath property, although I think I've tried every possibility. Below is my web service followed by my script.
using System; using System.Collections.Generic; using System.Linq; using System.Configuration; using System.Web; using System.Web.Services; using System.Data; using System.Data.SqlClient; using System.Data.Common; using AjaxControlToolkit; using System.Text; using System.Xml; using System.Xml.XPath; using System.IO; using System.Collections.Specialized; using System.Web.Services.Protocols; [WebService(Namespace = [URL])] [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 Service : System.Web.Services.WebService { public Service() { } [System.Web.Services.WebMethod] [System.Web.Script.Services.ScriptMethod] public string[] AutoCompleteNames(string prefixText, int count) { System.Data.SqlClient.SqlConnection cxn = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["HumanResourcesConnectionString"].ConnectionString); cxn.Open();.....................
I've set up a textbox with autocomplete, it works fine when i run is in visual studio, but when I deploy it to iis, the list items just do not appear.I think it has something to do with the fact that I'm using clean routes (with asp.net 4 routing).
I went through lots of forums, posts etc. But never found really good answer on this.I'm trying to add AutoComplete Extender to TextBox and display some tips to users.Everything is fine when this code is placed in Content Page. But I've got like ~10 Content Pages based on one Master Page so it's completely stupid to repeat the code on each one.
There are some answers on the web but they are only partial ones, check if you wan't:
In Key Press Event i have put the logic of search in textbox, when i press enter key it will take the values from textbox and brings the data in DataGrid.
In another event of GotFocus there is an logic of autocompletestring collection from Table. If i type a in that textbox it will shows all the suggested string in that.
If i comment the logic of GotFocus Event for textbox for autocomplete then only then Key Press events work else its not working. I dont know why its happening.
web service method(getMainHeads) with parameter is not calling with auto complete text box extender(same method with out parameter is calling fine). My Service is
[System.Web.Script.Services. ScriptService] public class InvService : System.Web.Services.WebService { ItemMainHeadMsts objItemMainHeadMsts; DatabaseHelper objDataHelper; [WebMethod] public string[] GetMainHeads(string value) { List<string> oList = new List<string >(); objItemMainHeadMsts = new ItemMainHeadMsts (); objDataHelper = new DatabaseHelper (); objItemMainHeadMsts = ItemMainHeadMstBase.SelectByFieldAuto("IMHDesc" , value); foreach (ItemMainHeadMst mainHead in objItemMainHeadMsts) { oList.Add(mainHead.IMHDesc); } return oList.ToArray();..........................
I've been stymied for a few days on and interface issue with Autocompleteextender and a simple textbox. Is the user types in the textbox while the scroll position of the page is near the top, the autocomplete pops under the textbox, just like it should.However, when I scroll down a little, the autocomplete pops over top of the textbox, making it impossible to see what you are typing. How do I force the autocomplete to pop under the textbox no matter the scroll position of the page? My code is below:
I am using an autocomplete in textbox and the values are from database.It is working fine.What i need is to do this autocomplete thing in listview when i enter any value in textbox. Here is my code
How can I get a gridview (that is inside an update panel) to update/filter whenever something it typed into a related textbox outside that panel..( possibly in another update panel)?
As in Google. When you start typing, it starts autocompleting for you by looking up words in the background using the text you've typed.
I want, in effect, for a user to start typing in a textbox (say "Order #" textbox) and each time a character is typed, to trigger an update to a gridview that has a 'search param' in it's SQL Datasource SP that plugs the textbox's text into the where clause of the select inside the SP...
make sense? I have the SP and all other related code, I would just need to know how to create a JS function (preferably via server-side using something like: