Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Professionals If you are an experienced ASP.NET programmer, this is the forum for your 3.5 questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Professionals section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old August 25th, 2009, 01:33 AM
Authorized User
Join Date: Jun 2009
Posts: 18
Thanks: 1
Thanked 0 Times in 0 Posts
Default JQuery Autocomplete problems

When I use Jquery autocomplete plugin,the page doesn't show the right results at some kind of case.
First,I create a ashx page,the following is the code:
<%@ WebHandler Language="C#" Class="Autocompletedata" %>
using System;
using System.Web;
using System.Data.Objects;
using System.Data.Objects.DataClasses;
using BusinessLogicModel;
public class Autocompletedata : IHttpHandler
    public void ProcessRequest(HttpContext context)
        string startCharacter = context.Request.QueryString["q"];
        using (NorthwindEntities ctx = new NorthwindEntities())
            string strEntitySql = "select value c from Products as c where c.ProductName like '%" + startCharacter + "%'";
            ObjectQuery<Products> category = ctx.CreateQuery<Products>(strEntitySql);
            context.Response.ContentType = "text/plain";
            foreach (Products c in category)
                context.Response.Write(c.ProductName + Environment.NewLine);
    public bool IsReusable
            return false;
Then,I create a aspx page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <link href="css/jquery.autocomplete.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="js/jquery-latest.js" type="text/javascript"></script>
    <script src="js/jquery.autocomplete.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        $(document).ready(function() {
    <input id="example" />
I've used all the required js and css document in my solution.

And run the project,and when I type a character,the textbox showed nothing, it didn't showed the results like google search.So I set the breakpoint,to follow the database,I found an odd thing: I run the sql sentence in the sqlserver2008,the result showed no row to be returned.I have my sql sentence typed below:
select Products.ProductName from
Products where
The result showed:
(0 行受影响)

But I have checked the table,it did have the data,you know.how can it be possible?

I wonder if the databse field stored the chinese character,so I update my ProductName all to English words.
And Then, I run the project,and the results works well.It showed the autocomplete function just like google search.But why?Why the filed is stored chinese character,the results is quite different.
So, anybody whoever can tell me? I'm crazy by this problem.

Thanks in advance!

Similar Threads
Thread Thread Starter Forum Replies Last Post
JavaScript vs JQuery skijor ASP.NET 3.5 Basics 4 August 7th, 2009 10:21 AM
XML AND JQUERY pallone BOOK: Beginning JavaScript and CSS Development with jQuery 10 July 10th, 2009 10:08 AM
jQuery Related Problems sakshamgautam BOOK: Professional ASP.NET MVC 1.0 ISBN: 978-0-470-38461-9 1 June 13th, 2009 08:20 PM
Article: Using the jQuery Selectors API jminatel BOOK: Beginning JavaScript and CSS Development with jQuery 0 April 20th, 2009 11:58 AM
Jquery html() on IE browser jspach2000@yahoo.com Javascript 0 March 28th, 2009 12:16 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.