Hello, I'm developing and application that uses the autocompleteextender.
This autocomplete should work more or less as the "add adress" bar in an email program. You introduce text, the app suggests something, you choose any suggestion then write a ";" and start de process again until you got al your adresses neatly separated by ";" in a multiline textbox;
Via the DelimiterCharacters i'm getting this effect using ";" as the delimiter character. What I don′'t like is the way it renders after you have chosen one field:
See what I mean? I don't want the "El inquilino comunista" in front of every suggestion, I've already choosen it. The more suggestions you choose the more confusing it becomes:
I would like the suggestions to be (after i've already chosen "El Inquilino Comunista" and "The White Stripes")
Alan Sparhawk
Alanis Morisette
Alasdair Roberts ...
Any ideas how to acomplish it?
Thank you.
Hi,
I think you may accomplish this in the server side method that fills the DropDownlist.
1. Get the last word separated by the delimiter
2. Fill results according to the word.
For instance:
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static string[] GetCompletionList(string prefixText, int count)
{
string[] result = new string[16];
int index = prefixText.LastIndexOf(";");
if(index >= 0)
prefixText = prefixText.Substring(index);
for (int i = 0; i < 16; i++)
{
result[i] = prefixText + i.ToString();
}
return result;
}
Hope this helps.
No comments:
Post a Comment