Integrating jQuery Autocomplete plugin with ASP.NET

I wanted to use the jQuery Autocomplete plugin:

    $(document).ready(function() {
        var url = "SomeData.aspx";
        $("#myTextBox").autocomplete(url, {
            minChars: 2
        });
    });

Where the url needs to return with one value on each line. I suppose an HTTP handler (.ashx) would be more suitable for this, rather than a web form, but I wanted to utilize the MVP framework already in place which had all the code needed to get the data from the DB. When I tried to get the .aspx to output just plain text without any HTML tags by removing the MasterPageFile attribute from the @Page directive, I got the following error:

Using themed css files requires a header control on the page. (e.g. <head runat=”server” />).

After mucking around a bit, I found that the following worked for me:

<%@ Page Language="C#" AutoEventWireup="true" Codebehind="SomeData.aspx.cs" Inherits="MyProject.SomeData" Theme="" %>

26 January 2010 | jQuery, ASP.NET | Comments

Comments:

  1.  
  2.  
  3.