Using Asp.Net Content Pages

My last post which was Asp.Net-related was about the use of master pages. Today, I am writing about Content Pages and how to use it together with Master Pages.

Having re-read the first Asp.Net-related post, I realized that it is better to include a step by step instruction via screenshots while doing all of these inside Visual Studio. In my next articles, I will definitely include screenshots but for now, please bear with me as this is my first blog for coding and technology-related stuff.  x_x

It is actually very straight forward and will be much, much simpler to understand. When creating a new content page in Visual Studio, you will be given an option to choose which master page you’ll use (yes, multiple master pages are supported). After which, the following lines of code will be the pre-populated for you.

Home.aspx

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Home.aspx.cs" Inherits="Home" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<!-- Commented text -->
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
Test content
</asp:Content>

The usual HTML tags are nowhere to be found as it will be “inherited” from the master page specified. We can just focus on the functionalities of the page that we are working on instead of worrying about the uniformity of the user interface for the whole website.

In line 1, notice that the MasterPageFile attribute is set to the name of the master page that we created in the previous article.

Lines 2-4 and 5-7 are the content areas where we will be placing our page content. These can be images, textboxes or any user interface elements. If we look back at our previous article, these corresponds to the content place holders located in the master page’s head and body tags, respectively.

If we are to display this page together with the masterpage, the code would – more or less – look like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <!-- Commented text -->
</head>
<body>
    <form name="aspnetForm" method="post" action="Home.aspx" id="aspnetForm">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    
Test content
</form> </body> </html>

On my next article, I will be including screenshots with Visual Studio in action and more examples of Asp.Net Master Pages and Content Pages.  😀

A few items bought at Amazon

 

A couple of weeks ago after ordering my new laptop, I went online and bought a few items from Amazon. One was for the new laptop which is a wireless mouse from Logitech and the other was a Nike+ Ipod sensor for my “planned” jogging workouts.  x_x

Ordering was smooth as long as you have a US address as the shipping address. My order was placed on 18 APR and the goodies arrived at Oregon 21 APR. 😀 It was in good condition and Amazon kept on sending emails as to where my order is at.

Nike+ Ipod Sensor for US$19.00

 

Logitech Performance Mouse MX for US$85.61

 

What’s interesting is that this mouse from Logitech uses a technology which they called Darkfield Laser Tracking (OMG! Lazer! Pew! Pew!) that enables it to be usable even on glass surfaces. Another wonderful technology that came with the mouse was the “connect-and-forget” Unifying Receiver that is so small, you can forget about it after connecting it on a USB port.  🙂

Logitech Unifying Receiver. The orange sign means Unifying-compatible.

 

What’s also great about this receiver is it’s ability to unify your Unifying-compatible Logitech products. It basically means that you can have up to six different wireless gadgets but use up only one USB port. As of press time, the only Unifying-compatible products are composed of wireless mice, wireless keyboards and wireless notebook kit. Hopefully, Logitech will add more products in the future.  😉

Logitech Unifying Receiver compared to a standard sized USB connector.

 

I have yet to try to have gadgets bought online delivered directly here in the Philippines as most of the time, Amazon does not ship electronic gadgets to this country. They can and will deliver books and CDs/DVDs but from what I witnessed from an officemate, it still passes though the Bureau of Customs which requires a lot of effort and is often times subjected to absurd taxes.  :((

 

Some friends have recommended the likes of Johnny Air Cargo but I have yet to have the courage (and a huge amount of cash lying around) to put at risk just to try their services when buying electronic gadgets online. Hopefully I will have both soon enough.  ;))