After people started to use our application reBlogger extensively and filled it with hundred of feeds, it become quite difficult to find a particular feed if someone requested it (for example, one blogger emailed us asking to remove his feed from reBlogger). The obvious solution for this problem whas to provide users with auto complete textbox, that will let them easily find a particular feed. Here is the screenshot of this reBlogger feature :
To achieve this, you need a classic Asp.NET text box, whose functionality you will later extend with Atlas:AutoCompleteExtender. So first the textbox :
There are few attributes here that you need to pay attention to. First of all it is TargetControlID, where you need to set the ID of the TextBox control that you want to extend (in our case, that is txtBlogTitle). Second attribute is the ServiceMethod, which is the name of the function that will return array of type string with suggested value (I’ll explain this function later in the post, so keep reading). Then we have ServicePath, which is nothing more than relative path for the .asmx file where GetBlogTitlesForAutoComplete function is located. Lastly, we have MinimumPrefixLength attribute. Obviously, this determines how many characters need to be entered by user so that the textbox starts suggesting results. For very large lists you may want to set this even higher (3 or 4), to increase performance, but bear in mind that it’ll be less useful at the same time.Now, that’s all we need to do in the .aspx page. Now, let’s turn to the manage_blogs.asmx file that actually returns the values to the AutoComplete textbox. I’ll write the whole function here first and then explain it.
The code is commented so you should have no problems understanding it. This is of course, just one way of doing it. The main thing is that you return a string array back. Also, it is important to note that you need to have the function with the signature as shown.
This blog is being delivered to you by
“Do you know what your employees are blogging about?”