Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Ajax Autocomplete problem in asp.net

Ajax Autocomplete problem in asp.net

Scheduled Pinned Locked Moved ASP.NET
databasecsharpasp-netcomsysadmin
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gopinathtamil
    wrote on last edited by
    #1

    The below code is i tryed for ajax auto complete on my site.. plz say if their is any bugs... default2.aspx ]]> function IAmSelected(source, eventArgs) { alert(" Key : " + eventArgs.get_text() + " Value : " + eventArgs.get_value()); }

    BehaviorID="AutoCompleteEx" TargetControlID="TextBox1" ServicePath="WebService.asmx" MinimumPrefixLength="3" EnableCaching="true" ServiceMethod="GetCompletionList">

    autocomplete.cs using System; using System.Collections.Generic; using System.Web.Services; using System.Data; using System.Data.SqlClient; using System.Web.Script.Services; /// /// Summary description for WebService /// [WebService(Namespace = "http://tempuri.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.ScriptService] public class WebService : System.Web.Services.WebService { public WebService () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public string[] GetCompletionList(string prefixText) { { string sql = "select Aname From Pincode Where Aname like @prefixText"; SqlDataAdapter da = new SqlDataAdapter(sql, "Server=sql346.mysite4now.com;uid=aitts_85478;password=aitts;database=aitts_85478"); da.SelectCommand.Parameters.Add("@prefixText", SqlDbType.VarChar, 50).Value = prefixText + "%"; DataTable dt = new DataTable(); da.Fill(dt); // List items = new List(); string[] items = new string[dt.Rows.Count]; int i = 0; foreach (DataRow dr in dt.Rows) { items.SetValue(dr["Aname"].ToString(), i); //items.Add(dr["Location_Name"].ToString()); i++; } // return items.ToA

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups