Posts

jQuery datatables plugin

Datatables is a powerful jQuery plugin. It provides searching, sorting and pagination. Let us understand the power and use of this plugin with a simple example. Consider the following HTML table <table id="datatable">     <thead>         <tr>             <th>ID             </th>             <th>City             </th>             <th>Country             </th>             <th>Continent             </th>         </tr>     </thead>     <tbody>         <tr>             <td>1</td>           ...

Cascading dropdownlist using jquery and asp.net

Step 1 : Create the required tables and stored procedures Create Table tblContinents (  Id int identity primary key,  Name nvarchar(50) ) Go Insert into tblContinents values ('Asia') Insert into tblContinents values ('Europe') Insert into tblContinents values ('South America') Go Create Table tblCountries (  Id int identity primary key,  Name nvarchar(50),  ContinentId int foreign key references dbo.tblContinents(Id) ) Go Insert into tblCountries values ('India', 1) Insert into tblCountries values ('Japan', 1) Insert into tblCountries values ('Malaysia', 1) Insert into tblCountries values ('United Kingdom', 2) Insert into tblCountries values ('France', 2) Insert into tblCountries values ('Germany', 2) Insert into tblCountries values ('Argentina', 3) Insert into tblCountries values ('Brazil', 3) Insert into tblCountries values ('Colombia', 3) Go Create Tab...

jQuery autocomplete with images and text

Step 1 : Create the countries table and the stored procedure to retrieve data Create table tblCountry (     Id int identity primary key,     Name nvarchar(100),     FlagPath nvarchar(200) ) Go Insert into tblCountry values('Canada','/Flags/canada.png') Insert into tblCountry values('Chile','/Flags/chile.png') Insert into tblCountry values('China','/Flags/china.png') Insert into tblCountry values('Cyprus','/Flags/cyprus.png') Go Create proc spGetCountries @Name nvarchar(100) as Begin     Select * from tblCountry where Name like @Name + '%' End Go Step 2 : Create new asp.net web application project. Name it Demo. Step 3 : Include a connection string in the web.config file to your database. <add name="DBCS"       connectionString="server=.;database=SampleDB;integrated security=SSPI"/> Step 4 : Add a folder with Name = flags to the project. Copy and paste the res...