Data Haunting

Easy Solutions Destination


Select2 simple example in web forms

In this article we will see how to use Select2 plugin with aspx control in our web forms application. Here I will demonstrate everything step by step.

Let’s start to demonstrate with following example.
Select2 example in

We have already seen the example regarding Select2 implementation in MVC at our articles Select2 simple example in MVC. While implementing Select2 example, if you have jquery error like Uncaught query function not defined for Select2 than for solutions you can go at Uncaught query function not defined for Select2.

Implement Select2 with Aspx Textbox Control

Now in our .aspx page let’s apply Select2 to TextBox before that you have to be ensure that you have downloaded Select2 and added in your application plus provided proper path in your application.

Only difficulty which we have to keep in mind while applying Select2 to aspx control like TextBox is that when aspx control render at that time aspx control’s Id is changed. So to overcome this problem one thing we can do is that we can use class with CssClass property and applying Select2 to this class property value and second thing we can do with aspx Control Id which is changed, suppose aspx control id is txtName so in jquery we can use like $(“input[id$=’idName’]”). Below I have provided sample code for Select2.

What is your opinion ?

Here we have seen example of Select2 in I hope it will be very useful to implement Select2 in your application and you will enjoy it. If you have any query and question, you can comment or you can mail me.

Leave a Reply