- About us
In single line Textbox, Ajax Control Toolkit - AutocompleteExtender works fine. Once we use AutocompleteExtender in a Multiline Textbox and think of using new line as delimiter character, then it used to give some issue. (In MultilineTextbox, suggestions to come 'one time - in each line' is a frequently required need.)
The problems are like
- some time suggestions do not come
- some time the suggestions come in first line (after we play some trick in the service call), but do not come in the next line
- at times it overwrite previous (first line) suggestion, in a next line call.
This types of problem comes, because AutocompleteExtendar do not regard "\n" as delimiter character in all the line break cases.
"\r\n" is the right combination of linebreak delimiter, but if we set this in design time, it does not work at all.
The simplest solution to this problem is setting "\r\n" as delimiter character in the server side code.
I struggled for getting this clue for few days, and here is the tip to help some one in a similar situation.
In this sample code below, I used a Multiline TextBox (txtDemo) with AutocompleteExtender. The web service EmployeeName.asmx have a method GetEmployeeName() that support the extender to fill in the suggestions.
In .aspx Page
<asp:TextBox ID="txtDemo" runat="server" TextMode="MultiLine" ></asp:TextBox>
<cc1:AutoCompleteExtender ID="txtDemo_AutoCompleteExtender" runat="server"
FirstRowSelected="True" ServiceMethod = "GetEmployeeName"
ServicePath = "EmployeeName.asmx">
In code behind
protected void Page_Load(object sender, EventArgs e)
txtDemo_AutoCompleteExtender.DelimiterCharacters = "\r\n";
ASP.NET, Ajax Control Toolkit, Ajax, AutocompleteExtender