Step 2 Laying Out the Page

Select the WebFormi.aspx file and then right-click it to bring up the context menu. Select Rename from the menu and rename the file Dynamicimage.aspx (don't forget or mistype the extension—it's required).

Tip You can press F2 to rename a file, just as you can in Windows Explorer.

Double-click the Dynamicimage.aspx file to open it in the editing pane. By default, ASPX pages open in Design mode. If you're not in Design mode, click the Design tab at the bottom of the editing window to complete this example.

Tip If you usually prefer to edit the HTML directly, you can change the default by clicking Tools ® Options and then selecting the HTML Designer item from the list of options. Change the Start Active Server Pages In option to Design View and then click OK.

Right-click somewhere on the surface of the Web Form in the editing window and select Properties from the context menu. You'll see the DOCUMENT Property Pages dialog (see Figure 4.5).

Figure 4.5: DOCUMENT Property Pages dialog

Enter Dynamic Image Example in the Page Title field. Set Target Schema to internet Explorer 5.0 and the Page Layout setting to GridLayout. Hit OK when you are finished.

On the left side of your screen, you'll see a Toolbox tab. Move your mouse cursor over the tab; Visual Studio displays the Toolbox. Click the Web Forms bar, then click the Label Control item. Move your cursor back into the editing window and draw the Label control. You've just placed a Web Form label on the page. You should remember that Web Form controls are not the same as HTML controls, although they look identical; they have a different namespace from the equivalent HTML controls. Web Form Label controls and HTML Label controls (and most other controls that contain text) have a Text property like a Windows TextBox control rather than a Caption property like a classic VB Form Label control.

Next, drop a TextBox control next to the label. Your Web Form should look similar to Figure 4.6. That's it for page design—not elaborate, but functional. Next, you need to write a little code.

ttu'iDyfuii'tclnufje.d^pH j

Figure 4.6: The DynamicImage.aspx Web Form after placing controls

Was this article helpful?

0 0

Post a comment