AutoComplete Extender in VS 2008
-
Hi, AutoComplete Extender (using ajax autocompleteextender) is not working fine in VS2008 asp.net web application project.Database I used is MS Access 2007 Here is my code: using System; using System.Collections; using System.Linq; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; using System.Xml.Linq; using System.Data; using System.Data.OleDb; /// <summary> /// Summary description for MyWebService /// </summary> [WebService(Namespace = "http://microsoft.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. //[System.Web.Script.Services.ScriptMethod] [System.Web.Script.Services.ScriptService] public class MyWebService : System.Web.Services.WebService { public MyWebService () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] [System.Web.Script.Services.ScriptMethod] public string[] GetCountryInfo(string prefixText) { int count = 10; string sql = "Select * from Country Where Country_Name like @prefixText"; OleDbDataAdapter da = new OleDbDataAdapter(sql, "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:/Documents and Settings/Leeds_Desk2/My Documents/trials.accdb"); da.SelectCommand.Parameters.Add("@prefixText", OleDbType.VarChar, 50).Value = prefixText + "%"; DataTable dt = new DataTable(); da.Fill(dt); string[] items = new string[dt.Rows.Count]; int i = 0; foreach (DataRow dr in dt.Rows) { items.SetValue(dr["Country_Name"].ToString(), i); i++; } return items; } } ASPX File ------------- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <!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>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox> <asp:Button ID="Button1" runat="server" Tex
-
Hi, AutoComplete Extender (using ajax autocompleteextender) is not working fine in VS2008 asp.net web application project.Database I used is MS Access 2007 Here is my code: using System; using System.Collections; using System.Linq; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; using System.Xml.Linq; using System.Data; using System.Data.OleDb; /// <summary> /// Summary description for MyWebService /// </summary> [WebService(Namespace = "http://microsoft.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. //[System.Web.Script.Services.ScriptMethod] [System.Web.Script.Services.ScriptService] public class MyWebService : System.Web.Services.WebService { public MyWebService () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] [System.Web.Script.Services.ScriptMethod] public string[] GetCountryInfo(string prefixText) { int count = 10; string sql = "Select * from Country Where Country_Name like @prefixText"; OleDbDataAdapter da = new OleDbDataAdapter(sql, "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:/Documents and Settings/Leeds_Desk2/My Documents/trials.accdb"); da.SelectCommand.Parameters.Add("@prefixText", OleDbType.VarChar, 50).Value = prefixText + "%"; DataTable dt = new DataTable(); da.Fill(dt); string[] items = new string[dt.Rows.Count]; int i = 0; foreach (DataRow dr in dt.Rows) { items.SetValue(dr["Country_Name"].ToString(), i); i++; } return items; } } ASPX File ------------- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <!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>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox> <asp:Button ID="Button1" runat="server" Tex
If you are going to post code use pre tags, look at the "code block" menu item on the toolbar above the textbox where you entered your question. Also make sure you read the forum guidelines. Have you debugged your application? Which part is not working? The extender? The database call?
I know the language. I've read a book. - _Madmatt
-
Hi, AutoComplete Extender (using ajax autocompleteextender) is not working fine in VS2008 asp.net web application project.Database I used is MS Access 2007 Here is my code: using System; using System.Collections; using System.Linq; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; using System.Xml.Linq; using System.Data; using System.Data.OleDb; /// <summary> /// Summary description for MyWebService /// </summary> [WebService(Namespace = "http://microsoft.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. //[System.Web.Script.Services.ScriptMethod] [System.Web.Script.Services.ScriptService] public class MyWebService : System.Web.Services.WebService { public MyWebService () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] [System.Web.Script.Services.ScriptMethod] public string[] GetCountryInfo(string prefixText) { int count = 10; string sql = "Select * from Country Where Country_Name like @prefixText"; OleDbDataAdapter da = new OleDbDataAdapter(sql, "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:/Documents and Settings/Leeds_Desk2/My Documents/trials.accdb"); da.SelectCommand.Parameters.Add("@prefixText", OleDbType.VarChar, 50).Value = prefixText + "%"; DataTable dt = new DataTable(); da.Fill(dt); string[] items = new string[dt.Rows.Count]; int i = 0; foreach (DataRow dr in dt.Rows) { items.SetValue(dr["Country_Name"].ToString(), i); i++; } return items; } } ASPX File ------------- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <!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>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox> <asp:Button ID="Button1" runat="server" Tex
Check these links AutoComplete Demonstration[^] AutoComplete From Database[^] Ajax AutoComplete in ASP.NET[^]