I just installed VS 2008 RTM and the autocomplete has issues. I created a new page added the scriptmanager and set it up to enablepagemethod so that I could use my local database to supply the autocomplete strings.
I dropped a textbox on the page then I dropped the extender onto the control. It appeared in the properties list of the textbox as expected. I changed some properties and set the ServiceMethod.
The extender did not alter the source. All the property changes were lost. I tied this several times and always the same result. The properties could be changed in the properties window but these are not updated in the source aspx page. So when you switch to source view from design the changes are simply lost.
For those who would like to implement a pagemethod rather than a webservice call, I found two good sources:
http://allwrong.wordpress.com/2007/03/13/ms-ajax-autocomplete-extender-using-a-page-method/
http://fredrik.nsquared2.com/viewpost.aspx?PostID=393
From my codebehind page:
<* The autocomplete extender is designed to use a web service to supply the items for the list box. Sometimes this
* is certainly an over-kill or the data may be accessable directly from the application's database connection. A
* web service is an un-needed layer for these times. So here is how to call a "page method" to supply that data.
*
* 1 - add: using System.Web.Services;
* 2 - In the html, modify the ScriptManager with the EnablePageMethods set to true.
* ex: <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True"></asp:ScriptManager>
* 3 - add a declaration for the page method: [WebMethod]
* 4 - add: public static string[] methodNameHERE(string prefixText, int count)
*
*/
/// <summary>
/// ServiceMethod - The method to be called. The signature of this method must match EXACTLY as below.
/// </summary>
/// <param name="prefixText"></param>
/// <param name="count"></param>
/// <returns>string array</returns>
[WebMethod]
public static string[] getCompanyNames(string prefixText, int count)
{
bbCMScore bb = new bbCMScore();
string[] s = bb.getGroupingUsingUserCompanyNameSource(prefixText, count).ToArray();
return s;
}
The ASPX code looks like this:
<asp:TextBox ID="tbGrouping" runat="server"></asp:TextBox>
<cc1:AutoCompleteExtender ID="tbGrouping_AutoCompleteExtender" runat="server" EnableCaching="true" CompletionSetCount="20" CompletionListCssClass="autocomplete_completionListElement" CompletionListItemCssClass="autocomplete_listItem" CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" MinimumPrefixLength="2" TargetControlID="tbGrouping" ServiceMethod="getCompanyNames">
</cc1:AutoCompleteExtender>
The above works as it should. The problem is the properties are not updating. This causes VS 2008 RTM to error with a "souce code not available" error which certainly doesn't point to the real problem. You thought you set the properties and really they were not set.
Larry Aultman