Free Web Development Online Tutorials, Learn to Code
Learn Aspx, Free Tutorial in C#, Web Application Development Guide Web Form Tutorial

Design AspX Web page with Master Page

Using ASP.NET Web Form you can create dynamic websites very easily; it provides you everything to build a powerful UI-driven site rapidly.

Here you learn how to create a web form and receive user input and submit the form.

Remember when you create a aspx page in, the page itself a form, and at submit button click event you can capture all user input in code behind (aspx.cs )

Step 1: Create a Project of type "Asp.Net Web Forms Application"

create webform application

Now you once you click "Ok", a new web form project will be created, by default there will be some pages like home, about, contact etc.

But still we add another new page so you learn how to add a new page / form, Remember in web forms application whenever you add a new page, that’s a form, so don't get confused by "form" and "page" terminology, both are actually same though technically they have different characteristic.

Add Web Form in Project

Step 2: Create a new Web Form / Page webform application

A new web form page is added in your project with following code

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="company.aspx.cs" Inherits="" %>
<!DOCTYPE html>
<html xmlns="">
<head runat="server">
<title>Web Form </title>
<form id="form1" runat="server">
<div> </div>

Notice, one form tag has been added in your webpage.

Now probably you have a master page in your project, so you need to add the master page reference in this page also.

Remember, if you want to add master page reference in this page, you need to remove the form tag from this page, because master page has a form tag, and in web page you can have only one form tag

Web form with Master page in

To add master page in your web form page, simply go to page directive and set the MasterPageFile name. by default there is one masterpage called "Site.Master" is created with project. but you can add a new master page as per your need.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Fileupload.aspx.cs"
MasterPageFile="~/Site.Master" Inherits="WTRWebForm.Fileupload" %>

After adding master page reference you need to remove all other html code, now everything should come under following asp:Content tag

<asp:Content runat="server" ID="FeaturedContent" ContentPlaceHolderID="FeaturedContent">
// all page content goes here.          

All page specific content will go inside the asp:Content tag

Adding master page in all your webpage will make the application standard and consistent, also if you want to make changes in any common area like header, footer , left navigation etc. it will very easy to change in just one place and the change will get reflected in all over application.

Subscribe web form example with C#, Tutorial