Using ASPX controls to parameter search a access database



1. Open up two new aspx pages save one as results.aspx and the other as search.aspx.

2. open search.aspx

3.Open the standard controls in the toolbox

 tool box controlsaspx standard control textbox

4. Drag and Drop the ASP.NET Standard Control - Textbox into the form on the search.aspx page.

5. Make sure the text box control is selected and then go to the Tag Properties pane, scroll down to the ID and type in the name of the field that you want to search in your database.  In this case we will type in LastName.

Tab Properties for text box Id selector in tag properties for text box


6. Next we will add a button control from the standard controls by draging and dropping the standard button control next to the text box. .

7. Make sure the button control is selected and go to the tag properties, click on the AZ button  and select the text property and type Do the search, then go to the postbackurl and type in results.aspx

Tag properties of search button

8. Save the page.

9. Open results.aspx

10. In the tool box expand the data controls and drag the grid control to the results.aspx page. Click the down arrow in the choose data source, then click <new data source>

Grid control on results.aspxChoose data source gridview

You will see:

New Data Source

11. Click on Access Database:  you will see:

Choose data source access

12. Click Ok, you will see:

Access data source search

13. Browse to the database you are working with.

search for active database


14.  Select the database  Note the database must be an access 2002,2003 database.

selecting access database

15. Click Next, you will see:

select table and fields for grid view

16. Select the table and the fields from the table,  in this example the results table has been selected and by placing a check in the astrick all the fields will be selected.

Selecting table or query and fields.

17. Now select the where button, you will see:

Where clause


18. In the column selector select lastname, the operator is =, the source is Form, the form field is lastname, the default value is left blank.  Click the add button, you will see:

after clicking the add button

19. Click Ok, you will be returned to the configure data source screen,  Click next, you will see:

test query

20. Click the test query button you will see:

test query

21, Click Ok, you will see:

Parameter values edition

22. Click finish, you will see:

23. You can clik auto format and choose from a number of formats if you wish or just save the page and close it. Then open up the search.aspx in the browser and fill in the search parameter.