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
  1. Home
  2. Web Development
  3. ASP.NET
  4. on Autocomplete, call ashx page to get data

on Autocomplete, call ashx page to get data

Scheduled Pinned Locked Moved ASP.NET
javascriptquestioncsharpasp-netdesign
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.
  • R Offline
    R Offline
    Ravi Sant
    wrote on last edited by
    #1

    I was not very sure where to post this. Found aspx and httphandler related to asp.net so posted here. I have used JQuery to call autocomplete on a textbox1 as below:

    $("input#textbox1").autocomplete({
    source: ["India", "Japan", "United Kingdom", "United States", "Australia", "France", "China"]
    });

    This works fine. When i try to change this to

    $("input#textbox1").autocomplete('GenericHandler.ashx');

    , the 'GenericHandler.ashx' never gets called. In ProcessRequest method of GenericHandler, i have written

    context.Response.Write("India|Japan|United Kingdom|United States|Australia|France|China");

    I have included appropriate verb in web.config for caller. How do i achieve the autocomplete calling ashx and then getting data to fill ? Please help. note: I am using jquery-ui.min.js for AutoComplete.

    K 1 Reply Last reply
    0
    • R Ravi Sant

      I was not very sure where to post this. Found aspx and httphandler related to asp.net so posted here. I have used JQuery to call autocomplete on a textbox1 as below:

      $("input#textbox1").autocomplete({
      source: ["India", "Japan", "United Kingdom", "United States", "Australia", "France", "China"]
      });

      This works fine. When i try to change this to

      $("input#textbox1").autocomplete('GenericHandler.ashx');

      , the 'GenericHandler.ashx' never gets called. In ProcessRequest method of GenericHandler, i have written

      context.Response.Write("India|Japan|United Kingdom|United States|Australia|France|China");

      I have included appropriate verb in web.config for caller. How do i achieve the autocomplete calling ashx and then getting data to fill ? Please help. note: I am using jquery-ui.min.js for AutoComplete.

      K Offline
      K Offline
      ktrrzn
      wrote on last edited by
      #2

      hi RaviSant, As far as i know, u can use JSON format to return ur result from ashx file. and in the .autocomplete use options as parameter. like this.

      var options, a;
      jQuery(function(){
      options = { serviceUrl:'GenericHandler.ashx' };
      a = $('#query').autocomplete(options);
      });

      and in the web service class, return the JSON format like this.

      {
      query:'Li',
      suggestions:['India', 'Japan', 'United Kingdom', 'United States', 'Australia', 'France', 'China'],
      data:['IN','JP','UK','US','AZ','FR','CH']
      }

      query is the entered search key suggestions is the list to display in dropdown data is optional to use as value field when u select suggestion data from dropdown text To know more about JSON,here[^] To learn how to return JSON format from ashx, here[^] Ref: I get this code from devbridge.com[^] Hope this works!

      Please give any idea or suggestion on my advice.

      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