ASP.NET Web Pages Using the Razor Syntax

ASP.NET Web Pages Using the Razor Syntax

ASP.NET Web Pages Using The Razor Syntax Microsoft® ASP.NET Web Pages is a free Web development technology that is designed to deliver the world's best experience for Web developers who are building websites for the Internet. This book provides an overview of how to create dynamic Web content using ASP.NET Web Pages with the Razor syntax. Note This document is preliminary documentation for the Beta 2 release of Microsoft WebMatrix and ASP.NET Web pages and is subject to change. For the latest information, visit http://www.asp.net/webmatrix. Contents Contents ............................................................................................................................................1 Chapter 1 – Getting Started ................................................................................................................1 What is WebMatrix Beta? ......................................................................................................................................... 1 Installing WebMatrix Beta ......................................................................................................................................... 1 Getting Started with WebMatrix Beta ...................................................................................................................... 2 Creating a Web Page ................................................................................................................................................. 4 Installing the ASP.NET Web Helpers Library .............................................................................................................. 7 Using ASP.NET Web Pages Code ............................................................................................................................... 9 Creating and Testing ASP.NET Pages Using Your Own Text Editor ..................................................................... 12 Chapter 2 – Introduction to ASP.NET Web Programming Using the Razor Syntax ............................... 13 The Top 8 Programming Tips ................................................................................................................................... 13 HTML Encoding ................................................................................................................................................... 14 HTTP GET and POST Methods and the IsPost Property ....................................................................................... 19 A Simple Code Example ........................................................................................................................................... 20 Basic Programming Concepts .................................................................................................................................. 22 Classes and Instances.......................................................................................................................................... 23 Language and Syntax ............................................................................................................................................... 24 Additional Resources ............................................................................................................................................... 45 Chapter 3 – Creating a Consistent Look ............................................................................................. 46 Creating Reusable Blocks of Content ...................................................................................................................... 46 Creating a Consistent Look Using Layout Pages ...................................................................................................... 49 Designing Layout Pages That Have Multiple Content Sections ............................................................................... 53 Making Content Sections Optional .......................................................................................................................... 56 Passing Data to Layout Pages .................................................................................................................................. 57 Creating and Using a Basic Helper ........................................................................................................................... 63 Chapter 4 – Working with Forms ...................................................................................................... 65 Creating a Simple HTML Form ................................................................................................................................. 65 Reading User Input From the Form ......................................................................................................................... 66 HTML Encoding for Appearance and Security ..................................................................................................... 68 Validating User Input ............................................................................................................................................... 69 Restoring Form Values After Postbacks .................................................................................................................. 71 Additional Resources ............................................................................................................................................... 72 Chapter 5 – Working with Data ......................................................................................................... 73 Introduction to Databases ....................................................................................................................................... 73 Relational Databases .......................................................................................................................................... 74 Creating a Database ................................................................................................................................................ 74 Adding Data to the Database .................................................................................................................................. 76 Displaying Data from a Database ............................................................................................................................ 77 Structured Query Language (SQL)....................................................................................................................... 79 Inserting Data in a Database ................................................................................................................................... 80 Updating Data in a Database ................................................................................................................................... 84 Deleting Data in a Database .................................................................................................................................... 89 Connecting to a Database ................................................................................................................................... 93 Additional Resources ............................................................................................................................................... 94 Chapter 6 – Displaying Data in a Grid ................................................................................................ 95 The WebGrid Helper ................................................................................................................................................ 95 Specifying and Formatting Columns to Display ....................................................................................................... 97 Styling the Grid as a Whole ..................................................................................................................................... 99 Paging Through Data ............................................................................................................................................. 101 Chapter 7 – Displaying Data in a Chart ............................................................................................ 103 The Chart Helper ................................................................................................................................................... 103 Creating a Chart from Data ................................................................................................................................... 105 "Using" Statements and Fully Qualified Names ................................................................................................ 110 Displaying Charts Inside a Web Page .................................................................................................................... 111 Styling a Chart ....................................................................................................................................................... 112 Saving a Chart ........................................................................................................................................................ 114 Additional Resources ............................................................................................................................................. 120 Chapter 8 – Working with Files ......................................................................................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    272 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us