22.05.2017 Views

BIS 450 DeVry Week 4 I Lab 4

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

TIP: The database folder should have been created automatically when your personal Web folder was created. It has<br />

the correct permissions assigned to allow ASP.NET to work with the database. The database file must be located in<br />

this folder in order to work correctly.<br />

2. Pull down the Website menu and select Add Existing Item.<br />

3. In the Add Existing Item dialog, navigate to where you saved the HealthyEating.mdb database file that you<br />

downloaded from Doc Sharing. (If you are working on the Citrix i<strong>Lab</strong> server, and you saved the file on your local<br />

computer, remember that your local computer’s disk drives are the ones with dollar signs $.) Select the<br />

HealthyEating.mdb file and click Add.<br />

You should now be able to see the HealthyEating.mdb file located under the database folder in the Solution Explorer<br />

window. (You may need to click the + symbol beside the database folder to expand it, in order to see this.)<br />

STEP 3: Create Food Information Guide Web Form<br />

1. In the Solution Explorer window, click on the Web site root (ftp://bisweb.devry.edu/coursefolder/yourname) to select<br />

it; then add a new Web form named FoodInfo.aspx to the site.<br />

2. Set the Title property of the Document to Food Information Guide.<br />

3. Attach StyleSheet.css to the Web form.<br />

4. As you did when setting up the Web forms in the previous labs, open Default.htm and copy the contents of its element<br />

(in HTML, everything in between the and tags, but not the and tags themselves). Paste these contents inside the div in<br />

FoodInfo.aspx (in HTML, in between the<br />

and<br />

tags). Delete the contents of the #main div after pasting.<br />

5. Inside div#main, type Food Information Guide as a heading for the form, followed by a blank line. Bold this heading.<br />

6. Type the prompt Food:. To the right of this prompt, place a TextBox from the Standard section of the Toolbox. To<br />

the right of the TextBox (on the same line), place a Button. Set the properties of each control as indicated below:<br />

Control (ID) Text<br />

TextBox txtFood<br />

Button btnFindFood Find Food Info<br />

7. Use the Enter key to move to the next line on the form. Drag an AccessDataSource control from the Data section of<br />

the Toolbox onto the Web form. When you first place the AccessDataSource on the form, it will have a “smart tag”<br />

labeled “Access Data Source Tasks” beside it. We will use this later when we configure the data source.<br />

TIP: You can display or hide the smart tag by selecting the control and then clicking the < or=""> at the right corner of<br />

the control.<br />

8. Click to the right of the AccessDataSource control on the form and use the Enter key to move to the next line. Drag<br />

a GridView control from the Data section of the Toolbox onto the form. If necessary, hide the smart tag (by clicking the<br />

< button)="" and="" drag="" the="" right="" edge="" of="" the="" gridview="" control="" to="" stretch="" it="" across=""<br />

the=""><br />

Your Web form should now look like the following in Design View:<br />

9. Save the Web form.<br />

STEP 4: Configure AccessDataSource Control<br />

1. Click the AccessDataSource1 control and, if necessary, click the > button in the upper right corner to display the<br />

control’s smart tag. Click the Configure Data Source task in the smart tag.<br />

2. In the first screen of the Configure Data Source wizard, type database/HealthyEating.mdb in the Microsoft Access<br />

data file box; then click Next >.<br />

TIP: It is best to type in the path and name of the database file; clicking the Browse… button to select the database is<br />

NOT recommended. If you do select the database by browsing, Visual Studio may insert a “~/” in front of the database

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!