
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 3 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 Chapter 1 – Getting Started with WebMatrix Beta and ASP.NET Web Pages ........................................1 What is WebMatrix Beta? ......................................................................................................................................... 1 Installing WebMatrix Beta ......................................................................................................................................... 1 Getting Started with WebMatrix Beta ...................................................................................................................... 2 Creating a Web Page ................................................................................................................................................. 4 Installing Helpers with Package Manager ................................................................................................................. 7 Using ASP.NET Web Pages Code ............................................................................................................................... 9 Programming ASP.NET Razor Pages in Visual Studio .............................................................................................. 12 Creating and Testing ASP.NET Pages Using Your Own Text Editor ..................................................................... 13 Chapter 2 – Introduction to ASP.NET Web Programming Using the Razor Syntax ............................... 15 The Top 8 Programming Tips ................................................................................................................................... 15 HTML Encoding ................................................................................................................................................... 16 HTTP GET and POST Methods and the IsPost Property ....................................................................................... 21 A Simple Code Example ........................................................................................................................................... 22 Basic Programming Concepts .................................................................................................................................. 24 Classes and Instances.......................................................................................................................................... 25 Language and Syntax ............................................................................................................................................... 26 Additional Resources ............................................................................................................................................... 47 Chapter 3 – Creating a Consistent Look ............................................................................................. 48 Creating Reusable Blocks of Content ...................................................................................................................... 48 Creating a Consistent Look Using Layout Pages ...................................................................................................... 51 Designing Layout Pages That Have Multiple Content Sections ............................................................................... 55 Making Content Sections Optional .......................................................................................................................... 58 Passing Data to Layout Pages .................................................................................................................................. 59 Creating and Using a Basic Helper ........................................................................................................................... 65 Chapter 4 – Working with Forms ...................................................................................................... 67 Creating a Simple HTML Form ................................................................................................................................. 67 Reading User Input From the Form ......................................................................................................................... 68 HTML Encoding for Appearance and Security ..................................................................................................... 70 Validating User Input ............................................................................................................................................... 71 Restoring Form Values After Postbacks .................................................................................................................. 73 Additional Resources ............................................................................................................................................... 74 Chapter 5 – Working with Data ......................................................................................................... 75 Introduction to Databases ....................................................................................................................................... 75 Relational Databases .......................................................................................................................................... 76 Creating a Database ................................................................................................................................................ 76 Adding Data to the Database .................................................................................................................................. 78 Displaying Data from a Database ............................................................................................................................ 79 Structured Query Language (SQL)....................................................................................................................... 81 Inserting Data in a Database ................................................................................................................................... 82 Updating Data in a Database ................................................................................................................................... 86 Deleting Data in a Database .................................................................................................................................... 91 Connecting to a Database ................................................................................................................................... 95 Additional Resources ............................................................................................................................................... 96 Chapter 6: Displaying Data in a Grid ................................................................................................. 97 The WebGrid Helper ................................................................................................................................................ 97 Displaying Data Using the WebGrid Helper............................................................................................................. 97 Specifying and Formatting Columns to Display ....................................................................................................... 99 Styling the Grid as a Whole ................................................................................................................................... 102 Paging Through Data ............................................................................................................................................. 103 Chapter 7 – Displaying Data in a Chart ............................................................................................ 106 The Chart Helper ................................................................................................................................................... 106 Chart Elements ...................................................................................................................................................... 107 Creating a Chart from Data ................................................................................................................................... 108 "Using" Statements and Fully Qualified Names ................................................................................................ 114 Displaying Charts Inside a Web Page .................................................................................................................... 115 Styling a Chart ....................................................................................................................................................... 116 Saving a Chart .......................................................................................................................................................
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages10 Page
-
File Size-