Warning AjaxControlToolkit.AutoCompleteExtender.CompletionListElementID is obsolete: Instead of passing in CompletionListElementID, use the default

StackOverflow https://stackoverflow.com/questions/7967456

Question

I really can not understand this problem. When i publish my asp.net 4.0 website it shows this error.

Warning 'AjaxControlToolkit.AutoCompleteExtender.CompletionListElementID' is obsolete: 'Instead of passing in CompletionListElementID, use the default flyout and style that using the CssClass properties.'

Now i am going to provide the element it shows as warning.

   <ajaxToolkit:AutoCompleteExtender runat="server" BehaviorID="AutoCompleteEx2" ID="AutoCompleteExtender4"
    TargetControlID="txtPokemonName" ServicePath="AutoCompleteName.asmx" ServiceMethod="GetCompletionListPokemonName"
    MinimumPrefixLength="1" CompletionInterval="500" EnableCaching="true" CompletionSetCount="25"
    CompletionListCssClass="AutoExtender" CompletionListItemCssClass="AutoExtenderList"
    CompletionListElementID="DIVAutoExtender2" CompletionListHighlightedItemCssClass="AutoExtenderHighlight"
    DelimiterCharacters=";, :" ShowOnlyCurrentWordInCompletionListItem="true">
    <Animations>
        <OnShow>
            <Sequence>
                <OpacityAction Opacity="0" />
                <HideAction Visible="true" />
                <ScriptAction Script="
                    // Cache the size and setup the initial size
                    var behavior = $find('AutoCompleteEx2');
                    if (!behavior._height) {
                        var target = behavior.get_completionList();
                        behavior._height = target.offsetHeight - 2;
                        target.style.height = '0px';
                    }" />
                                           <Parallel Duration=".4">
                    <FadeIn />
                    <Length PropertyKey="height" StartValue="0" EndValueScript="$find('AutoCompleteEx2')._height" />
                </Parallel>
            </Sequence>
        </OnShow>
        <OnHide>               
            <Parallel Duration=".4">
                <FadeOut />
                <Length PropertyKey="height" StartValueScript="$find('AutoCompleteEx2')._height" EndValue="0" />
            </Parallel>
        </OnHide>
    </Animations>
</ajaxToolkit:AutoCompleteExtender>

Now what does visual studio want me to fix and why showing this warning ?

Any ideas ? Thank you.

Visual Studio 2010 , C# 4.0 , Asp.net 4.0 , Asp.net website

Was it helpful?

Solution

The problem is that you are using an old (deprecated) attribute of the AutoCompleteExtender. The CompletionListElementID attribute is no longer supported. These are the styling attributes you should use (from the AutoCompleteExtender documentation page):

  • CompletionListCssClass - Css Class that will be used to style the completion list flyout.
  • CompletionListItemCssClass - Css Class that will be used to style an item in the AutoComplete list flyout.
  • CompletionListHighlightedItemCssClass - Css Class that will be used to style a highlighted item in the AutoComplete list flyout.

Note: CompletionListItemCssClass is the one that has replaced CompletionListElementID

They really provide all the flexibility you need. Happy coding!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top