Learn how to create a Master Page in new website that can be used to create all of the other ASP.NET files in the site


More DIY videos at 5min.com

Video Transcription

Now we are ready to create the first page of this website and in this case, we are going to create a Master Page and use that to create all of the other ASP.NET files in this site. So we're going to choose File, New, by the way, if you are just creating an ASP file, you could go with the shortcut and just choose ASP. But if you want to create a Master Page, you need to first choose Page to find the Master Page option, notice when I select Master Page, another option appears for programming language. You have a chance now to specify any of three languages, by default Expression Web generates code in C#, but you can also choose the VJ# or VB. If you are an advanced user or you are working with a programmer, you'll probably want to specify this language according to your preferences. But if you are not working with a programmer and you are not sure what to choose here, it really shouldn't matter because all of the code created will be behind the scenes anyway. So I am just going to leave this set to C#, click OK. Notice that when you create a Master Page, Expression Web automatically starts you out with this form and if you click inside, you'll see that it is a Content Placeholder. Content Placeholders in Master Pages are like editable regions in dynamic web templates. The only content you will be able to edit on a page that is generated from this Master Page will be contained inside this Content Placeholder. You can create as many Content Placeholders as you want in a Master Page and you will use them to distinguish areas of the page where you want content to change, like your Listings Content will be different from your Agents content. The rest of the page where you don't have Content Placeholders is for information you want to stay consistent, like the banner or the Navigation information. You should also know that Expression Web has created a Content Placeholder in the header of this document. You don't see it on the page but it's important not to delete that one, because that's what allows you to include style and to change page properties on each of your individual pages. The Content Placeholder that you do see on the screen here, we can delete, because we are going to add that back later. And I find it a little awkward to try and design around it. So let me just select it using the Delete key to remove it from my page. Working with Content Placeholders is one of those things that I think makes a lot more sense when you see it in action, so let's go ahead and start working on this page. When you design a Master Page, you do it just as you would any other page. I am going to use CSS for this design, but you could use HTML tables if you prefer. Overall, CSS is now by far, the recommended standard for layout and tables are only recommended for tabular data. So the kind of design I am creating in this Master Page, the Site design, is definitely best done in CSS. If you are familiar with CSS layouts, consider this a review and a chance to get your page setup, so that you can follow along with the rest of this ASP.NET training. If you are new to CSS, consider this a quick introduction and rest assured you'll find far more instruction on Expression Web and CSS at totaltraining.com. I always recommend that you save a new page in Expression Web right away, no matter what kind of page it is. So let's save this one and I am just going to name it name_page_master. Like any other page in a website, no spaces are special characters but you can use the underscore(_) or the dash(-). Now the Expression Web is going to warn me, you don't have any content regions defined, meaning if I use this Master Page to create a new page, there won't be any areas that I can alter on that new page. Well that's okay, like I said we are going to add that back in later, we just get rid of that automatically inserted Content Region so I had a nice clean area to start working on.