AJAX :: DropDownList With AutoComplete List
Dec 14, 2012Just wondering if this auto complete for text box to be modify for dropdown list.
Sometime I need value in drop down not shown in text box.
Base on: [URL] .....
Just wondering if this auto complete for text box to be modify for dropdown list.
Sometime I need value in drop down not shown in text box.
Base on: [URL] .....
I'm having some difficulty adding an autocomplete extender to a textbox and getting it working.
I've read through the samples and did a quick search on here, but cannot work out why it isn't working.
In a nutshell...
I've added a textbox onto a page, and added the autocomplete extender along with the AutoComplete page method.
Page
[Code]....
Code Behind
[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
public string[] GetCompletionList(string prefixText, int count, string contextKey)
{
StaffADBLL staff = new StaffADBLL();
DataTable dtStaff = staff.FindStaff(prefixText);
string[] items = new string[dtStaff.Rows.Count];
int i = 0;
foreach (DataRow row in dtStaff.Rows)
{
items.SetValue(row["displayName"].ToString(), i);
i++;
}
return items;
}
I've even tried adding an asmx file, and that doesn't work either.
I get no errors and when I start typing nothing happens, it doesn't even produce a list after 3 characters.
I tried to debug and it doesn't debug through the code, skips it completely.
The problem is simple, it doesn't fire (show the dropdownlist)
Here's all my code related to it.
Inside my masterpage:
[Code]....
I've compared it to many exemples and all is fine
If I test the service directly, it work
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 RepliesI'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
in my webapplication, I'm using asp.net dropdownlists, that are filled with data (text & id) through ObjectDatasources.
I'd like to use the jquery autocomplete on the dropdownlists, but I fail to find any good example for it, unless examples that are using http handlers or webservices, which I'd like to avoid.
I want use auto complete TextBox and multi select drop down list. If multi select drop down list worked auto complete TextBox show result in top. If auto complete TextBox worked multi select drop down list not worked. It’s my result but not my requirement. I shared code below but not my requirement.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="dolgeForm.aspx.cs" Inherits="RProject.dolgeForm" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="Scripts/jquery-ui.css" rel="stylesheet" type="text/css" />
[code]...
I have an ASP.NET AJAX autocomplete extender with CompletionListCssClass=autocomplete_completionListElement :
.autocomplete_completionListElement
{
width:500px;
margin : 0px!important;
background-color : inherit;
color : windowtext;
border : buttonshadow;
border-width : 1px;
border-style : solid;
overflow :auto;
height : 200px;
text-align : left;
}
But for some odd reason the width of the auto complete list always takes up the width of the textbox even when I set the width to 500px.
selecting a few items from a list of thousands. I have an autocomplete field that searches the db, and returns a name/id pair. This is working fine.
The next step is to preserve the selected IDs, and allow the user to remove some if needed. For this, I've been looking at using a select, and was hoping a UI something like that provided by this, but it doesn't work: it allows you to select items that already exist in the select, but doesn't work with a dynamically created select.
The final step is a traditional postback (using a submit button, this is in asp.net webforms) where I'll need to have access to the final list of IDs.
I have Used Ajax AutoComplete Extender In my Project But MY List Does Not Show On Ajax Model Popup Ajax Extender Sugges me Css For Display My Auto Complete List On Model Pouup Ajax Extender
This is My TextBox And AutoComplete Extender
<asp:TextBox runat="server" ID="txtsearcho" CssClass="txt2" Width="140" OnTextChanged="txtsearcho_TextChanged"
Visible="False" AutoPostBack="True"></asp:TextBox>
<asp:AutoCompleteExtender ID="txtsearcho_AutoCompleteExtender" MinimumPrefixLength="1"
runat="server" DelimiterCharacters="" Enabled="True" ServiceMethod="GetCompletionList"
ServicePath="" TargetControlID="txtsearcho" UseContextKey="True" CompletionListCssClass="AutoExtender"
CompletionListItemCssClass="AutoExtenderList" CompletionListHighlightedItemCssClass="AutoExtenderHighlight">
</asp:AutoCompleteExtender>
and This Is My CSS Class
.AutoExtender {
font-family: Verdana, Helvetica, sans-serif;
font-size: 1em;
font-weight: lighter;
border: solid 1px #006699;
line-height: 20px;
padding: 0px;
[Code] .....
It Work On Normal Text Box But Does'nt On Model Popup Extnder TextBox.
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 RepliesI'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 RepliesI'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.
i sample code for how to use wcf with ajax autocomplete
View 3 RepliesI'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 RepliesI'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.
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]....
how to use autocomplete extender in asp.net
View 1 RepliesI'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.
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.
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>.........
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).
My AJAX autocomplete control is not working. I have tried everything I can think of.
[Code]....
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.
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();.....................