Atlas: Setting the ServiceMethod of an AutoCompleteExtender

Recently we had a usergroup meeting on the subject of ASP.NET “Atlas” . In my current project, in which I’m rewriting a number of applications from Notes 6.5 to .NET 1.1 and 2.0, I took the liberty of using Atlas on a couple of webpages. When trying to implement a search feature, I obviously looked at the AutoCompleteExtender. Users needed to be able to search on one of four columns in a table. The ServiceMethod property is pointing to a webservice. This webservice needs to have the exact signature of (string  prefixText, int count). No room for any other parameters. Not to worry though, just create four webmethods and have these call the method doing the actual work.

Setting the ServiceMethod at runtime, e.g. in the DropDownListSearchParam_SelectedIndexChanged event handler, did not work. The changed ServiceMethod-name is not rendered in the resulting xml-script (just check your html). Another option is to insert some scripting in the page, like this:

    <atlas:AutoCompleteExtender runat=”server” ID=”autoCompleteSearch”>

        <atlas:AutoCompleteProperties TargetControlID=”TextBoxSearch”

              Enabled=”True”

              ServicePath=”~/services/WebServiceSearch.asmx”              

              ServiceMethod=’<% GetServiceMethod() %>

              minimumprefixlength=”1″  />

    atlas:AutoCompleteExtender>

But no. If you do this, the xml-script that is rendered simply contains &lt;% GetServiceMethod() %&gt;

However, if you set the ServiceMethod-property like this on the atlas:AutoCompleteExtender-element… bingo!