Bind a DropDown ASP Control to a Data View and Filter It
- Place your page into design view
- Click Task panes :: Data Source Library
- Click the data source called Categories
- Click to Insert Data Source Control
- If prompted, click “Yes” to display the control
- Place insertion point below this control
- Click Insert :: ASP.NET Controls > Drop Down List
- Click the Smart Panel :: Choose Data Source...
- Choose the Data Source (for example, SPListDataSource1)
- Tell it to display "CategoryName" (or the field that contains your category name)
- Make its value "CategoryName"
- Click OK
- Click to select the dropdownlist control
- Click the Smart Panel :: AutoPostBack == True
- Drag and drop the Products list onto a page to create a Data View
- Click the Smart Panel :: Edit Columns to add and remove the columns you want to display
- Click Data View :: Filter
- Create the following filter:
Field: CategoryName (or the field that contains your category name)
Comparison: Equals
Value: [Create a new Parameter]
Param Name: Param1
Source: Control
Control ID: DropDownList1
Default: Beverages - Click OK
- Click OK again
- Save the page
- Preview in the browser
- Make a change to the DropDownList control
Comments
Post a Comment