03.11.2016 Views

Beginning ASP.NET 4.5 in CSharp and VB Opsylum

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

768 x APPENDIX A EXERCISE ANSWERS<br />

Exercise 4 Solution<br />

To change the property of a control on a page, you can click the control <strong>in</strong> Design or Markup View<br />

<strong>and</strong> then use the Properties Grid (which you can br<strong>in</strong>g up by press<strong>in</strong>g F4) to change the value of the<br />

property. Alternatively, you can change the property directly <strong>in</strong> Markup View.<br />

CHAPTER 2<br />

Exercise 1 Solution<br />

A number of files fall <strong>in</strong> the Web Files category, <strong>in</strong>clud<strong>in</strong>g .aspx files (Web Forms that end up<br />

as pages <strong>in</strong> the web browser), .html files (that conta<strong>in</strong> static HTML for your site), .css files (that<br />

conta<strong>in</strong> cascad<strong>in</strong>g style sheet <strong>in</strong>formation), <strong>and</strong> .config files (that conta<strong>in</strong> configuration <strong>in</strong>formation<br />

for the website). Refer to the table with the different file types <strong>in</strong> Chapter 2 for a complete list<br />

of files.<br />

Exercise 2 Solution<br />

When you want to make a piece of text both bold <strong>and</strong> italicized, you need to select the text <strong>and</strong> then<br />

click the Bold button on the Formatt<strong>in</strong>g toolbar. Next you need to click the Italic button. The f<strong>in</strong>al<br />

HTML code <strong>in</strong> the page should look like this:<br />

Welcome to Planet Wrox<br />

You may also come across <strong>and</strong> elements, which have the same effect. However, these are<br />

now considered outdated <strong>and</strong> you’re encouraged to use <strong>and</strong> <strong>in</strong>stead.<br />

Exercise 3 Solution<br />

The first way is us<strong>in</strong>g the Solution Explorer. Right-click your site, choose Add Í Exist<strong>in</strong>g Item, <strong>and</strong><br />

then browse for the item(s) you want to add.<br />

Secondly, you can drag <strong>and</strong> drop files from File Explorer or W<strong>in</strong>dows Explorer or from your<br />

desktop directly <strong>in</strong>to a VS website. As a third alternative, you could put the files directly <strong>in</strong> the<br />

site’s folder us<strong>in</strong>g W<strong>in</strong>dows Explorer. For example, files you add to the folder C:\Beg<strong>ASP</strong><strong>NET</strong>\Site<br />

become part of your website automatically. If you don’t see the new files appear <strong>in</strong> VS directly, click<br />

the Refresh icon on the Solution Explorer toolbar.<br />

Exercise 4 Solution<br />

In VS, you have three different views on your code: Design View, Markup View (also referred to as<br />

Source View or Code View), <strong>and</strong> Split View. The first gives you an impression of how your web page<br />

is go<strong>in</strong>g to look <strong>in</strong> the browser, <strong>and</strong> the second view shows you the raw markup. Split View enables<br />

you to see both views at the same time. VS also has different views for other files. For example,<br />

programm<strong>in</strong>g code for an <strong>ASP</strong>X page is generally referred to as the Code Beh<strong>in</strong>d view or simply the<br />

Code Beh<strong>in</strong>d.

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

Saved successfully!

Ooh no, something went wrong!