

The second option is to add the list of items in between the opening and closing tags in Source view. First, you select the Edit Options task option when hovering your mouse over the control in Design view and open the Item Editor (see Figure 3).įigure 03: Editing ComboBox items( Click to view full-size image)

There are two ways that you can add these choices to the ComboBox control. The user can select a particular level of spiciness for their food from a list of three choices: Mild, Medium, and Hot (see Figure 2).įigure 02: Selecting from a static list of items( Click to view full-size image) We'll use the ComboBox control to display a static list of choices. You can find the ComboBox control in the Toolbox with the other AJAX Control Toolkit controls and control extenders (see figure1).įigure 01: Selecting the ComboBox control from the toolbox ( Click to view full-size image) Next, drag the ComboBox control onto the page. You should add the ScriptManager control at the top of the page you can add it immediately below the opening server-side tag. Drag the ScriptManager control from beneath the AJAX Extensions tab onto the Designer surface. If you want to use the ComboBox control in the page then you must add a ScriptManager control to the page. Add the new ASP.NET page to your project and switch to Design view. We'll create a new ASP.NET Web Forms page and use the ComboBox control in the page. You want to allow a user to enter a custom value into the list. However, you want to leave open the possibility that the list is not complete. Imagine that you want to display a static list of items in a dropdown list. Let's start with a simple sample of using the ComboBox control. Using the AutoComplete extender makes sense when you are working with a large set of data (millions of car parts) while using the ComboBox control makes sense when working with a small set of data (dozens of car parts). The ComboBox control, in contrast, is initialized with a set of items. The AutoComplete extender queries a web service to get matching entries. The ComboBox is similar to the AutoComplete control extender, but the controls are used in different scenarios. You can either select from a pre-existing list of items or enter a new item. The ComboBox works like a combination between a standard ASP.NET DropDownList control and a TextBox control. The goal of this tutorial is to explain the AJAX Control Toolkit ComboBox control. ComboBox is an ASP.NET AJAX control that combines the flexibility of a TextBox with a list of options from which users can choose.
