Tabs at the bottom of the editor make it easy to navigate between Designer, Code-Behind, and HTML. I mentioned earlier some difficulty in modifying the layout of table cells with the mouse. Situations like this make it necessary to modify the raw HTML for the web form. For this task, C#Builder offers a nice HTML editor with code coloring and formatting.
First, I want to talk about a handy feature in the Visual Designerthe HTML Tag Editor. When selecting controls on the Designer Surface, the HTML Tag Editor, located below the Designer Surface, displays HTML tags for the currently selected control. To modify the width of the left column, for example, I selected the upper-left cell on the Designer Surface and then modified the Style attribute of the corresponding <td> tag in the HTML Tag Editor. Another useful feature appears when you click in the HTML Tag Editor; blue arrows allow you to navigate the HTML hierarchically.
To work with the full HTML document, select the WebForm1.aspx tab at the bottom of the designer (see Figure 5). The filename on the tab will vary, depending on what you name your files in the Project Manager, but it always ends in .aspx.
Figure 5 The HTML editor lets you edit the raw HTML of your web form. It offers color-coded, formatted layout that makes it easy to work with HTML.
Notice in Figure 5 that I highlighted the <table> element. The Object Inspector shows the attributes of the table, giving you the option to type attributes in code or use the Object Inspector. Also, observe that the Tool Palette contains only HTML controls now. If you drag one of the controls from the Tool Palette and drop it onto the HTML editor, it renders the HTML element for that control in text.
Another feature of the HTML editor is the ability to control formatting with HTML Tidy:
Selecting Edit, HTML Tidy, Check Document for Errors checks the code for HTML-related problems.
Selecting Edit, HTML Tidy, Format sets all the text in the HTML editor to a predefined format.
-
Selecting Tools, Options, HTML Tidy Options shows configuration settings that allow you to customize your HTML Tidy formatting, as shown in Figure 6. (For more information on HTML Tidy, visit the W3C web site.)
Figure 6 HTML Tidy is a standard pretty-printing tool, defined by the World Wide Web Consortium (W3C). The HTML Tidy Options dialog offers dozens of options for defining various settings for HTML and XML documents.
Pressing F5 runs the application, bringing it up in your browser. If you get a security exception, you need to modify the ACL settings on the directory where the ASP.NET files reside. Give modify permissions to the ASPNET user on the local machine.
Selecting Tools, Options, ASP.NET Options enables you to configure your browser, web server, and new web project defaults. To configure project options, right-click the project in the Project Manager, and select Options, ASP.NET to configure the start page, virtual directory, and web server.