Using the LoadOnDemand Property
In This Topic
The LoadOnDemand property allows you to retrieve data dynamically. The child items are loaded when the user begins typing in the search box.
Complete the following steps:
- Right-click on the App_Data folder in the Solution Explorer and select Add | Existing Item from the list.
- Locate the C1Nwind.mdb database in your ComponentOne Samples folder and click Add to add the database to your project.
- Select the C1AutoComplete control in your project.
- Click the smart tag button to open the C1AutoComplete Tasks menu.
- Click the arrow on the Choose Data Source drop-down list and select New Data Source from the list. This will open the Data Source Configuration Wizard.
- Select SqlDatabase from the list and click OK. In the Choose Your Data Connection window, use the drop-down menu to choose C1Nwind.mdb as your data connection and click Next.
- In the Configure Select Statement window, select Products from the drop-down list under Specify columns from a table or view and click Next.
- Click Test Query to make sure the database is properly queried and then click Finish.
- Select the C1AutoComplete control in your project and then navigate to the Properties window.
- Locate the LoadOnDemand property in the Properties window and set it to True.
- Still in the Properties window, locate the MaxCount property and set it to 5. This property will limit the number of search results in the AutoComplete and must be used with the LoadOnDemand property.
- Press F5 to run your application and type "E" into the search box. The results should resemble the following image: