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. General Programming
  3. C#
  4. Ajax autocomplete in asp.net

Ajax autocomplete in asp.net

Scheduled Pinned Locked Moved C#
databasecsharpasp-netcomsysadmin
2 Posts 2 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

    M 1 Reply Last reply
    0
    • G gopinathtamil

      **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

      M Offline
      M Offline
      Michael Bookatz
      wrote on last edited by
      #2

      First off there is an ASP.net forum that you may get more help with Second please don't post so much code only the relevant problem areas Third when posting code please use the code block then people can read it easier and follow the code. and finally what error message are you getting?

      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