Sunday, March 11, 2012

Apply CSS / style to AutoCompleteExtender (ASP.NET AJAX CTP)

*bump*

I am also chasing an answer to this question.


The solution;

The AutoCompleteExtendender property has been renamed from DropdownID toCompletionListElementID
But this ID has changed from the server ID to theclient ID !

In my codebehind i have this:
AutoCompleteExtender1.CompletionListElementID = pnlSearchResults.ClientID


Thanks galen

Indeed I found an example onhttp://forums.asp.net/3/1458343/ShowThread.aspx

Unfortunately it seems you cannot change the color of the text or the background-color of the items in the list popping below the textbox.

font-family and font-size do work though.

Here is my code :

<asp:textbox id="TextBoxNomPrenom" runat="server" Columns="35" MaxLength="50" autocomplete="off" />
<div id="divAutoComp" runat="server" style="font-family:Comic Sans MS;background-color:Silver; color:Red;font-size:x-large"></div>
<asp:AutoCompleteExtender ID="aceNomPrenom" runat="server" Visible="true" CompletionInterval="10" CompletionSetCount="5" MinimumPrefixLength="3" ServicePath="../../webaspx/test/wsIndividus.asmx" ServiceMethod="GetAllIndividus" TargetControlID="TextBoxNomPrenom" />

Code-behind (in PageLoad or PreRender):

aceNomPrenom.CompletionListElementID = divAutoComp.ClientID;

No comments:

Post a Comment