DevExpress / AjaxControlToolkit

The ASP.NET AJAX Control Toolkit is a classic set of ASP.NET WebForms extensions.
https://devexpress.com/act
BSD 3-Clause "New" or "Revised" License
290 stars 137 forks source link

How use animation for autcomplete dinamically? #307

Closed cesartoro closed 7 years ago

cesartoro commented 7 years ago

How use animation for autcomplete dinamically?

MikhailTymchukDX commented 7 years ago

Hi @cesartoro , Would you please clarify your scenario?

cesartoro commented 7 years ago

I need a autocomplete for textbox dinamically created. The autocomplete controller is also created dinamiclly from code behind.

I have this control created in aspx that works:

                                <ajaxToolkit:AutoCompleteExtender
                                    runat="server"
                                    ID="autoComplete1"
                                    TargetControlID="txtSearch"
                                    ServiceMethod="GetCompletionList"
                                    ServicePath="/Webservices/ClientesAutoComplete.asmx"
                                    MinimumPrefixLength="1"
                                    CompletionInterval="1000"
                                    EnableCaching="true"
                                    CompletionListCssClass="completionList"
                                    CompletionListItemCssClass="listItem"
                                    CompletionListHighlightedItemCssClass="itemHighlighted"
                                    DelimiterCharacters=";,:">
                                    <Animations>
                                        <OnShow>
                                            <Sequence>
                                                <OpacityAction Opacity="0" />
                                                <HideAction Visible="true" />
                                                <Parallel Duration=".4"><FadeIn /></Parallel>
                                            </Sequence>
                                        </OnShow>
                                        <OnHide>
                                            <Sequence>
                                                <OpacityAction Opacity="100" />
                                                <HideAction Visible="false" />
                                                <Parallel Duration=".4"><FadeOut /></Parallel>
                                            </Sequence>
                                        </OnHide>
                                    </Animations>
                                </ajaxToolkit:AutoCompleteExtender>

And I need this working in code behind:

                    AjaxControlToolkit.AutoCompleteExtender ace = new AjaxControlToolkit.AutoCompleteExtender();

                    ace.ID = "autoComplete0" + i.ToString();
                    ace.ServiceMethod = "GetCompletionList";
                    ace.ServicePath = "/Webservices/ClientesAutoComplete.asmx";
                    ace.MinimumPrefixLength = 1;
                    ace.CompletionInterval = 1000;
                    ace.EnableCaching = true;
                    ace.CompletionListCssClass = "completionList";
                    ace.CompletionListItemCssClass = "listItem";
                    ace.CompletionListHighlightedItemCssClass = "itemHighlighted";
                    ace.DelimiterCharacters = ";,:";

                    //ace.Animations =
                    //    "<OnShow> " +
                    //    "    <Sequence> " +
                    //    "        <OpacityAction Opacity = \"0\" /> " +
                    //    "         <HideAction Visible = \"true\" /> " +
                    //    "          <Parallel Duration = \".4\">< FadeIn /></Parallel> " +
                    //    "       </Sequence> " +
                    //    "   </OnShow> " +
                    //    "   <OnHide> " +
                    //    "       <Sequence> " +
                    //    "           <OpacityAction Opacity = \"100\" /> " +
                    //    "            <HideAction Visible = \"false\" /> " +
                    //    "             <Parallel Duration = \".4\"><FadeOut /></Parallel> " +
                    //    "          </Sequence> " +
                    //    "      </OnHide>";

In the ace.Animations attibution the asp.net generates a exception:

{"Invalid Animation definition for TargetControlID=\"\": Um nome não pode ser iniciado pelo caractere ' ', valor hexadecimal 0x20. Linha 1, posição 155."}.

Thanks!!

cesartoro commented 7 years ago

I was missing the TargeControlID, but the problem presists with it,

MikhailTymchukDX commented 7 years ago

@cesartoro < FadeIn /> tag is invalid - it has a space after the opening angle bracket. Remove the space so you can assign the Animation value without errors.

cesartoro commented 7 years ago

Thank you.

The code is running.