Example of ASP. NET DropDownList

Source: Internet
Author: User

ASP. NET DropDownList category display

Our Master/Slave reports will list categories in the DropDownList, and display related products in the page's GridView Based on the selected list items. our first task is to display the category in DropDownList. open FilterByDropDownList In the Filtering folder. aspx: drag and drop a DorpDownList control from the Toolbox on this page and set its ID attribute to Categories. click the "Select data source" link on "DropDownList task. the Select data source Wizard starts.

 

ASP. NET DropDownList: Specifies the data source of the DropDownList control.

Add a data source control and name it CategoriesDataSource. The control will call GetCategories () of the CategoriesBLL class ().

 

ASP. NET DropDownList: Add a data source control and name it CategoriesDataSource.

 

ASP. NET DropDownList: select to use the CategoriesBLL class

 

ASP. NET DropDownList: configure the data source control using the GetCategories () method

After configuring ObjectDataSource, you must specify the data fields to be displayed in the DropDownList and the data fields used as the value of the data item. we specify CategoryName as the column to be displayed and CategoryID as the value field of the data item.

 

ASP. NET DropDownList: Specify CategoryName as the column to be displayed, and CategoryID as the value of the data item.

In this case, we have a DropDownList control filled with records in the Categories table. Figure 6 shows the work we have done so far in the browser.

 

ASP. NET DropDownList: DropDownList lists the current category

  1. ASP. NET 2.0 data Tutorial: Add An aspx page to a site
  2. ASP. NET 2.0 data Tutorial: Create a master page
  3. ASP. NET cross-page value passing skills
  4. ASP. NET 2.0 data Tutorial: add custom encoding to DAL
  5. ASP. NET 2.0 data Tutorial: completes the data access layer

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.