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 asp.net web form and receive user input and submit the form.
Remember when you create a aspx page in asp.net, 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"
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 asp.net 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.
Step 2: Create a new Web Form / Page
A new web form page is added in your project with following code
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="company.aspx.cs" Inherits="WTRWebForm.company" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Web Form </title> </head> <body> <form id="form1" runat="server"> <div> </div> </form> </body> </html>
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
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. </asp:Content>
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.