Practical-8
Problem Statement
Write a program to Create Simple Web Application using two or more web forms.
Solution
To create a simple web application using two or more web forms, follow the steps below:
- Create a new ASP.NET Web Application project in Visual Studio.
- Add a new Web Form to the project by right-clicking on the project in the Solution Explorer, selecting "Add" > "Web Form".
- Rename the Web Form to "Default.aspx".
- Open the "Default.aspx" file and design the user interface as per your requirements using HTML and ASP.NET controls.
- Add a button control to the "Default.aspx" form and set its ID to "btnNext".
- Double-click on the button control to generate the click event handler in the code-behind file.
- In the code-behind file, write the following code in the click event handler of the "btnNext" button:
protected void btnNext_Click(object sender, EventArgs e)
{
Response.Redirect("SecondForm.aspx");
}
- Add a new Web Form to the project by right-clicking on the project in the Solution Explorer, selecting "Add" > "Web Form".
- Rename the Web Form to "SecondForm.aspx".
- Open the "SecondForm.aspx" file and design the user interface as per your requirements using HTML and ASP.NET controls.
- Add a button control to the "SecondForm.aspx" form and set its ID to "btnPrevious".
- Double-click on the button control to generate the click event handler in the code-behind file.
- In the code-behind file, write the following code in the click event handler of the "btnPrevious" button:
protected void btnPrevious_Click(object sender, EventArgs e)
{
Response.Redirect("Default.aspx");
}
- Build and run the application to see the web forms in action.
This completes the solution for creating a simple web application using two or more web forms.