Question

C# problem Build an ASP.NET web application that has the following functionality: Allow a user to...

C# problem

Build an ASP.NET web application that has the following functionality:

  • Allow a user to enter the following information as input:
    • First Name
    • Last Name
    • Age
  • When the page initially loads, display the following text on the screen "No results available"
  • When a user clicks on the "Show Results" button (after entering sample data for the three fields shown above), construct a dynamic sentence using the following format and display it on the web page
    • " is years old!"
    • [Example: John Doe is 76 years old!]
  • Implement the appropriate variables in the final solution
  • Upload a zip file containing your entire web app project solution to the D2L dropbox folder by end of class

Homework Answers

Answer #1

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.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Scenario: You recently started working as the mobile app developer for a University and have been...
Scenario: You recently started working as the mobile app developer for a University and have been assigned to build a mobile app that calculates the students' grade. Your app should contain following screens: Screen 1 Labels for subject1, subject2, and subject3 Textboxes for subject1, subject2, and subject3 Labels for MaxGrade, MinGrade, and Avg.Grade Submit button Once user clicks submit button, you need to display letter grade in a label Screen 2 Screen that allows students to register for the course...
You must implement a dynamic webpage the provides a basic task-list functionality. In particular, you page...
You must implement a dynamic webpage the provides a basic task-list functionality. In particular, you page should provide a user an interface to add and remove a task as well as mark a task as completed. For this version of the assignment, the tasks will be added directly in the HTML page by manipulating the DOM. Moreover, you should maintain an array that stores task details. Each task comprise of three fields: task-title: which is a one-line description of the...
For this assignment you'll be creating an application that has the user input a subtotal, tax...
For this assignment you'll be creating an application that has the user input a subtotal, tax rate and tip percentage and then displays the sales tax, tip amount and the total. You'll use JQuery instead of the getElementByX functions AND you will display all messages on the page (no alert or prompt boxes) The starter file is based off of the Lab 2 sales_tax application. Feel free to borrow code from your lab solution but realize you will need to...
In the previous assessment, you used a static set of named variables to store the data...
In the previous assessment, you used a static set of named variables to store the data that was entered in a form to be output in a message. For this assessment, you will use the invitation.html file that you modified in the previous assessment to create a more effective process for entering information and creating invitations for volunteers. Rather than having to enter each volunteer and create an invitation one at a time, you will create a script that will...
Question 1 of 15 Which of the following is not a recommended starting point to enter...
Question 1 of 15 Which of the following is not a recommended starting point to enter sales of products/services? A. Quick Create > Invoice B. Register > New transaction C. Quick Create > Sales Receipt D. Customer detail page > New transaction E. Transactions > Sales > New transaction Question 2 of 15 Which of the following statements accurately describes bank rules? A. Bank rules are imported from the Bank's website into the For Review tab in the Banking Center...