Posts

Showing posts with the label JQuery

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 {...

Load partial page in jquery and ASP.Net MVC

In this post I will show you how much ASP.Net MVC and JQuery are making up a dangerous duet and how you can do big tasks in simple way with little efforts. We can take a look at a live example of what we will do in this post. In stackoverflow website specially users page and tags page you will find a text box to search users/tags. the page is loaded with some users info sorted with default setting. if you start to write something in that text box, the users collection will be filtered by the name you entered in ajax manner and ordered alphabetically(ascending). The issue here is how using the same piece of code that produce the whole page when it be loaded in first time to filter the users when you type some letters in the text box and update just the part that display the users data. Here the magic of ASP.Net MVC and  JQuery  come to the scene. Lets start to build our page first then start to filter our users collection. I will not show you how to cr...