Article
    C#
    ADO.Net
    .NET
    ASP.Net & Web Forms
    Custom Controls
    Web Development
    Exception Handling
    XML
    Database
    Security in .Net
    Testing
    Web Services
    Windows Services
    Windows Controls
    WCF
    AJAX
    WPF
    XAML
    Reporting
    Setup
    VB.Net
    LINQ
    JQuery
    SilverLight
    JavaScript
    HTML5
    Crystal Report
    Cloud Computing
    Share Point
    Visual C++
    MVC
    Android
    PHP
    Java
    HTML
    WordPress
    Joomla
    Products
    Drupal
    Windows Phone
    JSON
    LightSwitch
    iPhone/iPad
    Ruby on Rails
    IIS 7
    Windows 8
    CSS/CSS3
    Excel
    MS Access
    Shortcut Keys
    Visual SourceSafe
    Team Foundation Server
    API(s)
    Sencha-Touch
Follow Us
Follow _MindStick_ on Twitter View MindStick Software's LinkedIn profile View MindStick Software's Facebook profile
Top Contributor
Advertisement
Advertise with Us
Mindstick
Article Article  Forum Forum  Blog Blog  Quiz Quiz  Beginner Beginner  Careers Careers  Contact Contact  Login Login  
Home | Product | Services | About Us | Interview | DeveloperSection | Submit an Article | Submit Blog

Home >> AJAX >> Ajax Toolkit ComboBox Control in ASP.Net
Ajax Toolkit ComboBox Control in ASP.Net
Ajax Toolkit ComboBox Control in ASP.Net


by Pushpendra Singh on 12/6/2010 9:26:56 PM

Views: 5161       Comments: 0

Ajax Toolkit ComboBox Control in ASP.Net

The ComboBox works like a combination between a standard ASP.NET DropDownList control and a TextBox control. You can either select from a pre-existing list of items or enter a new item.

The ComboBox control is initialized with a set of items.

ComboBox Properties:

·         DropDownStyle - Determines whether the user is allowed to enter text that does not match an item in the list, and whether the list is always displayed. If "DropDownList" is specified, users are not allowed to enter text that does not match an item in the list. When "DropDown" (the default value) is specified, any text is allowed. If "Simple" is specified, any text is allowed and the list is always displayed regardless of the AutoCompleteMode property value.

·         AutoCompleteMode - Determines how the ComboBox automatically completes the text that is typed into it. When "Suggest" is specified, the ComboBox will show the list, highlight the first matched item. If "Append" is specified, the ComboBox will append the remainder of the first matched item to the user-typed text and highlight the appended text. When "SuggestAppend" is specified, both of the above behaviors are applied. If "None" (the default value) is specified, the ComboBox's auto-complete behaviors are disabled. See in this fig.

 

AjaxControl Toolkit ComboBox Control in ASP.Net

Code:

<%-- ScriptManager control manages client script for AJAX enabled ASP.NET pages--%>

Write these code on default.aspx page

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

 

<cc1:ComboBox ID="ComboBox1" runat="server" AutoCompleteMode="Suggest" AutoPostBack="True" DropDownStyle="Simple">

<asp:ListItem>India</asp:ListItem>

<asp:ListItem>Lanka</asp:ListItem>

<asp:ListItem>Pak</asp:ListItem>

<asp:ListItem>Aus</asp:ListItem>

<asp:ListItem>Aps</asp:ListItem>

</cc1:ComboBox>

 

<%--Here  AutoCompleteMode="Suggest" which specified that ComboBox will show the list, highlight the first matched item.--%>

 

<asp:Button ID="Button1" runat="server" Text="select country" OnClick="Button1_Click" />

<asp:Label ID="Label1" runat="server"></asp:Label>

Write these code on button1 click event

protected void Button1_Click(object sender, EventArgs e)

    {       

         Label1.Text = "You selected" + ComboBox1.SelectedItem.Text;      

    }

Run the project

When you enter any text in ComboBox then it will highlight matching value

AjaxControl Toolkit ComboBox Control in ASP.Net

When you click select country button then selected value will display in the Label

AjaxControl Toolkit ComboBox Control in ASP.Net

Report Abuse Form
Reason:    
 

Title :
Comment :
Text ColorBackground Color
BoldItalicUnderline
LeftCenterRightJustify
Ordered ListBulleted List
IndentOutdent
Horizontal Rule
SubscriptSuperscript
HyperlinkImage
Design ModeDesign
View HtmlHtml
     
 
Latest Article by Pushpendra SinghRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Latest BlogsRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Top Viewed ArticlesRSS Feed
    
    
    
    
    
    
    
    
    
    
Top Viewed BlogsRSS Feed
    
    
    
    
    
    
    
    
    
    
Latest Interview QuestionsRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Total Online Users: 2530
Advertisement
MindStick SurveyManager
Advertise with Us
  
Copyright © 2009 - 2013MindStick. All Rights Reserved.