Creating a Web Page

May 11, 2016
Creating a Web Page

Source view displays the HTML for the page, including the elements that Visual Studio has created for the server controls. Controls are declared using HTML-like syntax, except that the tags use the prefix asp: and include the attribute runat="server".

Control properties are declared as attributes. For example, when you set the property for the control, in step 1, you were actually setting the Text attribute in the control's markup.

Note that all the controls are inside a form element, which also has the attribute runat="server". The runat="server" attribute and the asp: prefix for control tags mark the controls so that they are processed by ASP.NET on the server when the page runs. Code outside of and elements is sent unchanged to the browser, which is why the ASP.NET code must be inside an element whose opening tag contains the runat="server" attribute.

Put the insertion point after asp:Label in the tag, and then press SPACEBAR.

A drop-down list appears that displays the list of properties you can set for a control. This feature, referred to as IntelliSense, helps you in Source view with the syntax of server controls, HTML elements, and other items on the page. The following illustration shows the IntelliSense drop-down list for the control.

IntelliSense attributes

Select ForeColor and then type an equal sign and a quotation mark (=").

IntelliSense displays a list of colors.

You can display an IntelliSense drop-down list at any time by pressing CTRL+J.

Select a color for the control's text. Make sure you select a color that is dark enough to read against a white background.

The ForeColor attribute is completed with the color that you have selected, including the closing quotation mark.

YOU MIGHT ALSO LIKE
HTML Lesson 1: Creating a Web Page
HTML Lesson 1: Creating a Web Page
Creating a web page in Moodle
Creating a web page in Moodle
Aperture-Creating a Web Page
Aperture-Creating a Web Page
Share this Post