Posts

Showing posts from 2016

AutoComplete using customized UIHint attribute in ASP.Net MVC

Image
In one project I worked on recently, I wanted to display list of suppliers which is very very long list, it was more than 6000 items. to display such number of items in dropdown list in a page of course will affect page load time. The best solution was using Autocomplete jQuery plugin , it is light, powerful, and covers my needs but unfortunately I need to display that suppliers list in many pages for different view models. One of possible solutions copy/paste autocomplete code snippet in each view.This solution didn't make me satisfied and I thought of course there is better way and more elegant to do it. One possible alternative is Editor Template, in most cases we need the Id value not the item full details. for simplicity I'm using list of programming languages as a data source. I override UIHint attribute to pass the URL of our datasource, the URL will be used as source for autocomplete jQuery plugin. public class AutoCompleteUIHintAttribute : UIHintAttribute {