Sunday, December 25, 2011

How to use ListSearchExtender on ListBox and DropDownList with AjaxControlToolkit

In this Tutorial we are performing Search for the Items available in ListBox and DropDownList by typing. The extender performs an incremental search within the ListBox based on what has been typed so far.

ListSearchExtender Issues:
In Safari Browser the ListSearchExtender only works with ListBoxes, not DropDownLists.
In Opera Browser the backspace key moves back a page in the browser history by default when it is pressed on a ListBox or DropDownList. To change this behavior you can go to Tools|Preferences|Shortcuts, edit the Keyboard setup, search for “back” and change the mapping for “Platform Windows-Unix-MCE, Backspace” to “Backspace” instead of “Backspace | Back”

In this Tutorial we are setting up values from database table into DropDownList and ListBox present on aspx page using SqlDataAdapter and DataSet.

SqlDataAdapter Represents a set of data commands and a database connection that are used to fill the DataSet and update a SQL Server database.

DataSet is a collection of data. Most commonly a dataset corresponds to the contents of a single database table, or a single statistical data matrix, where each column of the table represents a particular variable, and each row corresponds to a given member of the dataset in question.

Step1:  File->New->Website

Step 2: Create Database named Database.mdf
Create Table Named States under Tables.

States Table:

Step 3:  
aspx page code split view :

Step 4:
aspx.cs page code
Remember to write SqlConnection in one line otherwise it can show error.

View in Browser:


No comments:

Popular Posts