C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » C# Syntax »

Code for Enhancing the Search of Items in a Combo box:


Posted Date: 16 Aug 2007    Resource Type: Code Snippets    Category: C# Syntax
Author: kalyaniMember Level: Bronze    
Rating: 1 out of 5Points: 10



This code sample shows how to search an items in combo Box.


[ function Cbofunction(ddl)
{
var caseSensitive=false;
var undefined;
if(ddl.keypressBuffer==undefined)
{
ddl.keypressBuffer="";
}
var key = String.fromCharCode(window.event.keyCode);
ddl.keypressBuffer += key;
if(!caseSensitive)
{
ddl.keypressBuffer = ddl.keypressBuffer.toLowerCase()
}
var optionsLength =ddl.options.length;
for(var n=0;n {

var optionText = ddl.options[n].text;

if (!caseSensitive)
{
optionText = optionText.toLowerCase();
}
//alert(ddl.keypressBuffer);
if (optionText.indexOf(ddl.keypressBuffer,0) == 0)
{

ddl.selectedIndex = n;
return false;
}
}
ddl.keypressBuffer = key;
return true;
}



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: How to validate a date using c#
Previous Resource: Creating Datagrid
Return to Discussion Resource Index
Post New Resource
Category: C# Syntax


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use