Datasheet

Figure 1-11
8. Press Ctrl+F5 to open the page in your default browser. Note that it’s not necessary to explicitly
save the changes to your page (although it’s a good idea to do this often anyway using the short-
cut Ctrl+S). As soon as you press Ctrl+F5 to run the page, VWD saves all changes to open docu-
ments automatically.
If you don’t like this behavior, you can change it in Visual Web Developer’s Options dialog box, accessible
from the Tools menu. Make sure that Show All Settings is checked, and then open the Projects and
Solutions node and choose Build and Run. In the Before Building list, you can change the way VWD
behaves when you open a page in your browser.
9. Type some text in the text box and then click the button. Note that after the page has reloaded,
the text is still displayed in the text box. Other than that, not much has happened because you
didn’t write any code for the button yet.
How It Works
When you dragged the Button and the TextBox from the Toolbox on the page in Design View, VWD
added the corresponding code for you in Markup View automatically. Similarly, when you changed the
Text property of the button in the Properties Grid, VWD automatically updated the markup for the con-
trol in Markup View. Instead of using the Properties Grid, you could also have typed the text directly
between the quotation marks of the
Text property in the code window.
After changing the
Text property, your page should now look like this in Markup View:
<asp:TextBox ID=”TextBox1” runat=”server”></asp:TextBox>
<asp:Button ID=”Button1” runat=”server” Text=”Submit Information” />
When you press Ctrl+F5 to view the page in the browser, the web server receives the request, the page is
processed by the ASP.NET runtime, and the resulting HTML for the page is sent to the browser.
Take a look at the resulting HTML for the page using the browser’s View Source command (rerun the
page from VWD by pressing Ctrl+F5 if you already closed it). You should see code similar to this:
<input name=”TextBox1” type=”text” value=”Hello World” id=”TextBox1” />
<input type=”submit” name=”Button1” value=”Submit Information” id=”Button1” />
20
Chapter 1: Getting Started with ASP.NET 3.5
87593c01.qxd:WroxPro 1/25/08 9:05 AM Page 20