AJAX :: Autocomplete Script Does Not Work?
May 6, 2010
Why my autocomplete ajax script does not work:
This is my WebService.cs
[Code]....
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" MinimumPrefixLength="1" ServiceMethod="GetCountryInfo" TargetControlID="TextBox2" ServicePath="WebService.asmx" runat="server"></cc1:AutoCompleteExtender>
Categories row in database is text type...
I use ModalPopup, too(my textbox2 is in Modalpopup), does it makes problem?
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" MinimumPrefixLength="1" ServiceMethod="GetCountryInfo" TargetControlID="TextBox2" ServicePath="WebService.asmx" runat="server"></cc1:AutoCompleteExtender>
View 7 Replies
Similar Messages:
Apr 7, 2010
I've been racking my brains out trying to get this to work. I've followed multiple tutorials to the letter and I have had no luck.
Here is my Default.aspx page:
[Code]....
Here is my WebService.asmx.cs file:
[Code]....
I don't know what else there is to do. I have a zip of my solution here: [URL]
Edit: I forgot to add that I am able to run the WebService by itself. It returns the values from the function. The function is never invoked from the aspx though.
View 11 Replies
May 20, 2010
I have the following situation in my page: I've created a textbox and then set an AutoCompleteExtender to this textbox and, later I wanted to set the focus to this field with the code behind i set textbox.focus(), when i'm trying to add focus the AutoCompleteExtender simply not working, but when i click outside the text box and click back in , it's working.
Can anybody give me a simple explanation how to solve this situation.
View 1 Replies
Jul 22, 2010
I'm having a problem with AutoComplete tool see demo here [URL]
When enter 123 for first time, it works. Then click somewhere to close the result, clear textbox enter same value, it does not work. I got a description "...Caching is turned on, so typing the same prefix multiple times results in only one call to the web service." I tried turning off cache, but still not work.
View 2 Replies
Aug 4, 2010
i have a problem with autocomplete control i used in my page, but it does not works so, i do not know how to debug it for finding some problem i tried also to create new page and insert only textbox and autocomplete control...again does not works.... which is wrong?
[Code]....
[Code]....
View 3 Replies
Jun 11, 2010
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
View 7 Replies
Jul 2, 2010
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.
So GotFocus loic creates the problem.
[Code]....
View 1 Replies
Sep 29, 2010
I'm creating just simple autocomplete sample.
taking one textbox adding autocomplete extender as
<asp:ScriptManager ID="ScriptManager2" runat="server">
<Services>
<asp:ServiceReference Path="WebService.asmx" />
</Services>
</asp:ScriptManager>
<asp:TextBox ID="TextBox1" runat="server" EnableTheming="True" ></asp:TextBox>
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" MinimumPrefixLength="1" ServiceMethod="GetCountryInfo" ServicePath="WebService.asmx" TargetControlID="TextBox1">
</cc1:AutoCompleteExtender>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
Also creating web services as "WebService.asmx" & code inside this file is that
<%@ WebService Language="C#" CodeBehind="~/App_Code/WebService.cs" %>
------
then in Webservice.cs file i write code as
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;
}
this code is not working
View 1 Replies
Jan 11, 2011
I specially has used hotmail and I like its autocomplete for To Address. It works very nice like it not only shows saved contacts but also suggests address on which I have sent email but they are not saved in contacts.
The most important thing is it is very fast. It is not ajaxtoolkit's automcplete what is this control.
View 1 Replies
May 11, 2010
I have a user control which encapsulates a NumericUpDownExtender. This UserControl implements the interface ICallbackEventHandler, because I want that when a user changes the value of the textbox associated a custom event to be raised in the server. By the other hand each time an async postback is done I shoe a message of loading and disable the whole screen. This works perfect when something is changed in for example an UpdatePanel through this lines of code:
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(
function (sender, args) {
var modalPopupBehavior = $find('programmaticSavingLoadingModalPopupBehavior');
modalPopupBehavior.show();
}
);
The UserControl is placed inside a detailsview which is inside an UpdatePanel in an aspx. When the custom event is raised I want another textbox in the aspx to change its value. So far, When I click on the UpDownExtender, it goes correctly to the server and raises the custom event, and the new value of the textbox is assigned in the server. but it is not changed in the browser.
I suspect that the problem is the callback, since I have the same architecture for a UserControl with an AutoCompleteExtender which implement IPostbackEventHandler and it works. Any clues how can I solve this here to make the UpDownNumericExtender user control to work like the AutComplete one? This is the code of the user control and the parent:
using System;
using System.Web.UI;
using System.ComponentModel;
using System.Text;
namespace Corp.UserControls
{
[Themeable(true)]
public partial class CustomNumericUpDown : CorpNumericUpDown, ICallbackEventHandler
{
protected void Page_PreRender(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
currentInstanceNumber = CorpAjaxControlToolkitUserControl.getNextInstanceNumber();
}
registerControl(this.HFNumericUpDown.ClientID, currentInstanceNumber);
string strCallServer = "NumericUpDownCallServer" + currentInstanceNumber.ToString();
// If this function is not written the callback to get the disponibilidadCliente doesn't work
if (!Page.ClientScript.IsClientScriptBlockRegistered("ReceiveServerDataNumericUpDown"))
{
StringBuilder str = new StringBuilder();
str.Append("function ReceiveServerDataNumericUpDown(arg, context) {}").AppendLine();
Page.ClientScript.RegisterClientScriptBlock(typeof(CorpNumericUpDown),
"ReceiveServerDataNumericUpDown", str.ToString(), true);
}
nudeNumericUpDownExtender.BehaviorID = "NumericUpDownEx" + currentInstanceNumber.ToString();
ClientScriptManager cm = Page.ClientScript;
String cbReference = cm.GetCallbackEventReference(this, "arg", "ReceiveServerDataNumericUpDown", "");
String callbackScript = "function " + strCallServer + "(arg, context)" + Environment.NewLine + "{" + Environment.NewLine + cbReference + ";" + Environment.NewLine + "}" + Environment.NewLine;
cm.RegisterClientScriptBlock(typeof(CustomNumericUpDown), strCallServer, callbackScript, true);
base.Page_PreRender(sender,e);
}
[System.ComponentModel.Browsable(true)]
[System.ComponentModel.Bindable(true)]
public Int64 Value
{
get { return (string.IsNullOrEmpty(HFNumericUpDown.Value) ? Int64.Parse("1") : Int64.Parse(HFNumericUpDown.Value)); }
set
{
HFNumericUpDown.Value = value.ToString();
//txtAutoCompleteCliente_AutoCompleteExtender.ContextKey = value.ToString();
// TODO: Change the text of the textbox
}
}
[System.ComponentModel.Browsable(true)]
[System.ComponentModel.Bindable(true)]
[Description("The text of the numeric up down")]
public string Text
{
get { return txtNumericUpDown.Text; }
set { txtNumericUpDown.Text = value; }
}
public delegate void NumericUpDownChangedHandler(object sender, NumericUpDownChangedArgs e);
public event NumericUpDownChangedHandler numericUpDownEvent;
[System.ComponentModel.Browsable(true)]
[System.ComponentModel.Bindable(true)]
[System.ComponentModel.Description("Raised after the number has been increased or decreased")]
protected virtual void OnNumericUpDownEvent(object sender, NumericUpDownChangedArgs e)
{
if (numericUpDownEvent != null) //check to see if anyone has attached to the event
numericUpDownEvent(this, e);
}
#region ICallbackEventHandler Members
public string GetCallbackResult()
{
return "";//throw new NotImplementedException();
}
public void RaiseCallbackEvent(string eventArgument)
{
NumericUpDownChangedArgs nudca = new NumericUpDownChangedArgs(long.Parse(eventArgument));
OnNumericUpDownEvent(this, nudca);
}
#endregion
}
/// <summary>
/// Class that adds the prestamoList to the event
/// </summary>
public class NumericUpDownChangedArgs : System.EventArgs
{
/// <summary>
/// The current selected value.
/// </summary>
public long Value { get; private set; }
public NumericUpDownChangedArgs(long value)
{
Value = value;
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Corp
{
/// <summary>
/// Summary description for CorpAjaxControlToolkitUserControl
/// </summary>
public class CorpNumericUpDown : CorpAjaxControlToolkitUserControl
{
private Int16 _currentInstanceNumber; // This variable hold the instanceNumber assignated at first place.
public short currentInstanceNumber
get { return _currentInstanceNumber; }
set { _currentInstanceNumber = value; }
}
protected void Page_PreRender(object sender, EventArgs e)
{
const string strOnChange = "OnChange";
const string strCallServer = "NumericUpDownCallServer";
StringBuilder str = new StringBuilder();
foreach (KeyValuePair<String, Int16> control in controlsToRegister)
{
str.Append("function ").Append(strOnChange + control.Value).Append("(sender, eventArgs) ").AppendLine();
Append("{").AppendLine();
str.Append(" if (sender) {").AppendLine();
str.Append(" var hfield = document.getElementById('").Append(control.Key).Append("');").AppendLine();
str.Append(" if (hfield.value != eventArgs) {").AppendLine();
str.Append(" hfield.value = eventArgs;").AppendLine();
str.Append(" ").Append(strCallServer + control.Value).Append("(eventArgs, eventArgs);").AppendLine();
str.Append(" }").AppendLine();
str.Append(" }").AppendLine();
str.Append("}").AppendLine();
Page.ClientScript.RegisterClientScriptBlock(typeof(CorpNumericUpDown), Guid.NewGuid().ToString(), str.ToString(), true);
}
str = new StringBuilder();
foreach (KeyValuePair<String, Int16> control in controlsToRegister)
{
str.Append(" funcsPageLoad[funcsPageLoad.length] = function() { $find('NumericUpDownEx" + control.Value + "').add_currentChanged(").Append(strOnChange + control.Value).Append(");};").AppendLine();
str.Append(" funcsPageUnLoad[funcsPageUnLoad.length] = function() { $find('NumericUpDownEx" + control.Value + "').remove_currentChanged(").Append(strOnChange + control.Value).Append(");};").AppendLine();
}
Page.ClientScript.RegisterClientScriptBlock(typeof(CorpNumericUpDown), Guid.NewGuid().ToString(), str.ToString(), true);
}
}
}
and to create the loading view I use this: //The beginRequest event is raised before the processing of an asynchronous postback starts and the postback is sent to the server. You can use this event to call custom script to set a request header or to start an animation that notifies the user that the postback is being processed.
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(
function (sender, args) {
var modalPopupBehavior = $find('programmaticSavingLoadingModalPopupBehavior');
modalPopupBehavior.show();
}
);
//The endRequest event is raised after an asynchronous postback is finished and control has been returned to the browser. You can use this event to provide a notification to users or to log errors.
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(
function (sender, arg) {
var modalPopupBehavior = $find('programmaticSavingLoadingModalPopupBehavior');
modalPopupBehavior.hide();
}
);
View 1 Replies
Aug 10, 2010
I am tring to use Jquery autocomplete into my asp.net 2.0 application, I have all necessary file in place, I tried to worked on , but it seems like this is not working,can some one tell me that is asp.net 2.0 application without using AJAX toolkit works with Jquery autocomplete or it does not work?Note: this is plain asp.net 2.0 web application, it is not using AJAX.
View 6 Replies
Jan 27, 2010
I'm using C# and having problems with nested usercontrol within a usercontrol having AutoComplete textbox. I successfully implemented AutoComplete textbox in a usercontrol but doesnt work with nested one. The webservice does get called and i get the dropdown, but on selecting the text from the dropdown doesnt set the value in the hidden field. Tried to debug using Firebug, but it doesnt break at this function
View 2 Replies
Mar 28, 2011
I'm trying to create an autocomplete textfield using a database as source.
The user needs to enter a few letters and his/her name (record by the combination of 2 columns 'firstname' and 'lastname') pops up as a suggestion. The problem is that I would like to get the id of that record, since I need to get a hold of the rest of the user details.
I currently have this code:
[Code]....
In the ASPX page, I've tried this:
[Code]....
[Code]....
So generally, I think that my code is working as it should be. However, there seems to be a problem with returning both of the values so that the javascript is able to seperate them.
View 3 Replies
Jan 25, 2011
i sample code for how to use wcf with ajax autocomplete
View 3 Replies
Feb 17, 2011
I'm using jQuery AutoComplete Plugin in ASP.Net as outlined in the article below, so that as a user types in a .Net textbox they get a list of options to choose them. This works fine, but what I need to do now is call a server side function when the user has finished typing or has choosen a value, rather than the user having to submit the value by pressing a button.
View 2 Replies
Aug 10, 2010
I am using Ajaxtoolkit 3.5.I am using an autocomplete textbox extender.My problem is I have populated Country in the autocomplete textbox.I have to populate city in another dr
View 1 Replies
Nov 1, 2010
I've looked at this link and I've tried all the suggestions there, but my Asp.Net AJAX Autocomplete still isn't working.
I have a test project with only a label, text box an the auto-completer:
<asp:ToolkitScriptManager ID="ScriptManager" runat="server">
</asp:ToolkitScriptManager>
<asp:Label ID="FieldLabel" Text="Label:" runat="server"></asp:Label>
[code]....
In theory, my textbox should have an autocomplete dropdown containing 3 instances of the word "test". In practice, I can type anything I want into the textbox and nothing happens.
View 2 Replies
Jul 13, 2010
as you can see on this page: http://immobilzero.com/Prov2.aspx i have an autocomplete associated to textbox
the problem is not animation because i tried to delete but is that in the first time it appears, it goes too highter!!!
this is the code i use;
[Code]....
View 8 Replies
Jan 14, 2011
how to use autocomplete extender in asp.net
View 1 Replies
Apr 21, 2010
I want to implement the AutoComplete extender in my application. What I really want to capture is the EmployeeID. Obviously I want to display employee's name. Is there a way to do this?
I can return the employee name and do another look up but that's two hits on the database.
View 2 Replies
Jun 7, 2010
I am using AJAX Control toolkit V-1.0.
I am coming across one problem with auto complete extender in my application, problem seems to simple but i can't find any satisfactory solution. In one form, i have set auto complete extender on one text box, i have set one web service, in which one function is there, which fetches existing records from db, on first load, if i write releavent words with that of db, i can't see the extender, but if once either i minimize the page or give tab despite AutoPostBack property of text box is false, then after writing something in text box shows me the extender.
Here are the properties of both text box and extender
<asp:TextBox
ID="txtCompanyName"
runat="server"
CssClass="txt"
MaxLength="100"
TabIndex="4"
Width="443px"
></asp:TextBox>.........
View 1 Replies
Feb 18, 2010
I added an autocomplete extension to a textbox, set up the web service and everything else I needed to get back autocomplete data, traced through debugger to make sure I was getting back the results I needed - - but still no autocomplete results. I thought maybe it was because my textbox was within a formview, within a wizard control, within a master page that was preventing me from seeing the results, so I set up a standalone ajax webpage, put in a textbox, set my service method and service path properties, and let it rip. Still no results.
Finally, after tearing out clumps of hair, I browsed my website using Firefox instead of IE 8. And there it was - - the results I was expecting.
So what is it in IE that is preventing me from seeing the popup results? I disabled the pop-up blocker in IE and that didn't work. I added my website to the allowed website in the pop-up blocker settings and that didn't work either. My guess is it's something under Internet Options => Security => Custom Level but I don't know what (yes, I have Active Scripting enabled).
View 2 Replies
Oct 7, 2010
i'm trying to make this work for several days but it just doesn't work.
this is my code:
aspx page:
[Code]....
webservice:
[Code]....
this was downloaded from this website.
the problem is that the page loads fine but no autocomplete occurs.
View 5 Replies
Jul 8, 2010
My AJAX autocomplete control is not working. I have tried everything I can think of.
[Code]....
View 11 Replies
Jul 8, 2010
I have an auto complete extender applied to my textbox as follows:
[Code]....
In the web pages code behind I have the following method:
[Code]....
there is no errors, I've tested and debugged the code inside GetCustomers() and it returns the data - just doesn't display it.
View 10 Replies