How do I bind a SQL Server stored procedure to a JQuery autocomplete on an ASP.Net Textbox control?

motleycoder
motleycoder used Ask the Experts™
on
How do I bind a SQL Server stored procedure to a JQuery autocomplete on an ASP.Net C# Textbox control?

I got it to a point where my sample works with an array of data in the script file.  I have my input field on my .aspx page:

Player name: <input id="autocomplete" />

Open in new window


(I realize it is not binding to a .net textbox control, but I just want to get this working first, then I'll move on to making it work with a textbox control)

I'm including the following at the top of the page:

<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script type="text/javascript" src="Scripts/jquery-custom.js"></script>

Open in new window


In my jquery-custom.js file, I have the following:

$(document).ready(function () {
    $("input#autocomplete").autocomplete({
        source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"]
    });
});

Open in new window


The above works.  What I'd like to do is instead of the source pulling from a string array ("c++", "java", etc), the source pull data from a stored procedure.  I've been looking online for hours now and just can't quite find what I'm looking for.

Any help is greatly appreciated.

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
you have samples in the jquery ui site
http://jqueryui.com/demos/autocomplete/#remote-jsonp

Author

Commented:
I'm not seeing anything that directly ties to a stored procedure though.  Is it not possible?  All of the samples I'm reading about is for a web service or hard coded data in a page like above.
Commented:
web browser can't call directly your database (html5 has some kind of storage http://openbit.co.uk/?p=135 but it won't work only in latest browsers)
so you must have some kind of web service/handler/web page that will return the data you need in the browser.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial