Day 19. Separating Code from Content


Sams Teach Yourself ASP.NET in 21 Days, Second Edition
By Chris Payne
Table of Contents
Week 3.  At a Glance

Throughout the last 18 lessons, you've examined several ways to separate the user interface elements from the programmatic code (the VB.NET and C# code). For example, you looked at moving non-UI functionality into business objects, leaving the ASP.NET pages with only UI code. Additionally, as we examined in Day 12, "Employing Advanced Data Techniques," you can move database commands into stored procedures to keep them out of your ASP.NET pages. You can even store settings and variables in configuration files such as web.config.

Today you're going to explore a few more advanced methods for separating the source code from the content. In other words, separating the code that controls your application from presentation code (such as the HTML and Web controls). This separation is one that ASP.NET developers often strive for to reduce clutter and group code more logically. After all, an ASP.NET page is used to present a user interface, so why should it contain any other type of code?

You're also going to look at methods to customize your ASP.NET pages based on the location of your users. These methods allow you to modify the page content separately from your separated page code.

You'll be looking at a lot of code today, so let's get started!

Today's lesson will cover the following:

  • What code-behind forms are

  • How to make your ASP.NET pages use code-behinds

  • How to make your user controls use code-behinds

  • How to determine where your users are located (by the language they speak)

  • How to examine culture and region information for your users

  • How to extract commonly used strings from your ASP.NET pages and store them separately in resource files


    Sams Teach Yourself ASP. NET in 21 Days
    Sams Teach Yourself ASP.NET in 21 Days (2nd Edition)
    ISBN: 0672324458
    EAN: 2147483647
    Year: 2003
    Pages: 307
    Authors: Chris Payne

    Similar book on Amazon © 2008-2017.
    If you may any questions please contact us: