C# problem
Build an ASP.NET web application that has the following functionality:
Dear Student ,
As per the requirement submitted above , kindly find the below solution.
Here a new Web Application in asp.net with C# is created using Visual Studio 2017 with name "SampleWebApplication".This application contains a web page with name "Default.aspx".Below are the details of this web page
Default.aspx :
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="SampleWebApplication.Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<%-- title for web page --%>
<title>Personal Information</title>
</head>
<body>
<form id="form1" runat="server">
First Name :
<%-- textbox for firstName --%>
<asp:TextBox runat="server" ID="txtFirstName" />
<br />
<br />
Last Name :
<%-- textbox for lastName --%>
<asp:TextBox runat="server" ID="txtLastName" />
<br />
<br />
Age :
<%-- textbox for age --%>
<asp:TextBox runat="server" ID="txtAge" />
<br />
<br />
<%-- button to show result --%>
<asp:Button ID="btnShowResult" runat="server" Text="Show Result"
OnClick="btnShowResult_Click" />
<br />
<br />
<%-- label to display result --%>
<asp:Label runat="server" ID="lblResult" />
</form>
</body>
</html>
****************************
Default.aspx.cs :
//namespace
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
//application namespace
namespace SampleWebApplication
{
public partial class Default : System.Web.UI.Page
{
//page load event
protected void Page_Load(object sender, EventArgs e)
{
//display text when page loads
lblResult.Text = "No results available";
}
//show result button click
protected void btnShowResult_Click(object sender, EventArgs
e)
{
//display result on the textbox
lblResult.Text = txtFirstName.Text + " " + txtLastName.Text + " is
" + txtAge.Text + " years old!";
}
}
}
======================================================
Output : Run application using F5 and will get the screen as shown below
Screen 1 :Default.aspx
Screen 2:Enter details and click on show result to get details
NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.
Get Answers For Free
Most questions answered within 1 hours.