About the WebPagesMovies Site

This website accompanies the Introducing ASP.NET Web Pages 2 tutorial that's on the ASP.NET Web site (http://asp.net/web-pages). The example site lets you keep a simple list your favorite movies, and add, edit, and delete movie listings. The site was designed to help people learn how to work with ASP.NET Web Pages and with Microsoft WebMatrix, a free toolset for creating websites.

The site includes finished versions of all the pages that are illustrated in the tutorial:

  • Movies.cshtml. This page lists movies and includes links to let you add, edit, and delete movies.

  • AddMovie.cshtml. This page lets you create a new movie listing.

  • EditMovie.cshtml. This lets you change the information for an existing movie. You can get to this page from the Movies.cshtml page.

  • DeleteMovie.cshtml. This lets you delete a movie listing. As with EditMovie.cshtml, you get to this page from the Movies.cshtml page.

There's also a database (WebPagesMovies.sdf) with a Movies table that contains sample data.

There are two versions of the main pages. The finished pages use a layout page that provides a consistent look for all the pages. There are also versions of the pages that show how the pages were created originally, in the early part of the tutorial set. The earlier versions in this website project have - BeforeLayout as part of their file name.

Finally, there are three versions of the main Movies page. In addition to a version without the layout, there's a version of the page (- BeforeEditLinks) that reflects the page as of the end of Tutorial 4.

What the Tutorials Show

The tutorials that are associated with this website provide an introduction to ASP.NET Web Pages and to WebMatrix. They cover the following concepts and features:

Tutorial Major Points
Tutorial 1: Getting Started
  • What ASP.NET Web Pages (.cshtml files) are.
  • What WebMatrix is.
  • How to install everything using the Microsoft Web Platform Installer.
  • How to create a website by using WebMatrix.
Tutorial 2: Programming Basics
  • How you use Razor syntax (@ and { } ) to embed C# code in the markup (HTML) of a page.
  • How server-side code runs and how it returns markup to the browser.
  • C# basics: statements with semicolons, variables, strings, operators, comments,  objects (methods and properties), data types and converting them, if blocks.
  • How to use IsPost to see if a page was submitted (posted).
  • What helpers are, how to install them (if required), and how to use them in a page.
Tutorial 3: Displaying Data
  • How to use WebMatrix tools to create a database, create a table, and add data to the table.
  • How to use code to open a database and retrieve data.
  • How to use the WebGrid helper to display data in an HTML table.
Tutorial 4: HTML Form Basics
  • How to process an HTML form.
  • The difference between using a GET and a POST request when working with forms.
  • How to use Request.QueryString["name"] to read the value entered into a form element.
  • How to search for specific data using a SQL Where clause and placeholders.
  • How to use IsEmpty() to determine whether a form field contains a value.
  • How to "remember" what a user entered in a field.
  • How to use a SQL statement to create a "contains" search.
Tutorial 5: Entering Database Data By Using Forms
  • More about how to work with HTML forms.
  • How to test for a POST request using IsPost.
  • How to read form values using Request.Form.
  • How to add (insert) data in a database using a SQL Insert Into statement.
  • How to use the Validation helper to check user input.
  • How to display validation errors.
  • How to use code to redirect to another page.
Tutorial 6: Updating Database Data
  • How to add a column to the WebGrid helper that links to another page and passes a value from the current row to that page.
  • How to read a single value from a database using a SQL Where clause and placeholders.
  • How to update an existing row in a database using the SQL Update statement.
  • How to validate data that's passed to the page in a query string.
  • How to use a hidden field to store information in a page without displaying it.
Tutorial 7: Deleting Database Data Using ASP.NET Web Pages
  • How to delete a row in a database using the SQL Delete statement.
  • How to determine which button in a form cause the submit (post).
Tutorial 8: Creating a Consistent Look for ASP.NET Web Pages Sites
  • How to create a layout page (_Layout.cshtml) to act as a "container" for the site content.
  • How to create individual content pages that contain only the code and markup that isn't already in the layout page and how to link them to the layout page.
  • How to use the Page object to pass information from the content page to the layout page so that can customize layout details for each page.
Tutorial 9: Publishing an ASP.NET Web Pages Site using WebMatrix
  • How to find a hosting provider using WebMatrix and sign up for a hosting account.
  • How to use the WebMatrix Publish tool (and publish settings from the hosting provider) to deploy your site to the hosting provider.
  • How to republish your site after making changes.