Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have done all the above parts except the section in BOLD. Open the web application provided as Coding0504-Start. It includes the aspx and code-

I have done all the above parts except the section in BOLD.

Open the web application provided as Coding0504-Start. It includes the aspx and code- behind files for the pages shown above, but the first page doesnt have the code for the Confirm button and the second page doesnt have the code for either of the buttons that are shown. And neither page has the code for the label with the message thats displayed below the buttons.

Add the Confirm button to the Quotation page right after the Calculate button, and set its CssClass property to the btn and btn-primary classes.

Add the Send Quotation and Return buttons to the Confirmation page, and set the appropriate CssClass values. Also, set the properties for the Return button so it goes back to the Quotation page and doesnt cause validation.

On each page, add a label control below the buttons. For each label, set the ID to lblMessage, the CssClass to text-info, and the Text as shown above.

Test the application to see how its going, and make any adjustments.

Add the C# code that makes the application work

Create a Click event handler for the Confirm button of the Quotation page. This button should redirect to the Confirmation page, which will display the quotation that is being confirmed by getting the data from session state.

To make this work, the Click event handler for the Calculate button of the Quotation page should save the sales price, discount amount, and total price in session state. Now, add that code to that event handler.

When the user clicks the Confirm button on the Quotation page to go to the Confirmation page, the Load event handler for the Confirmation page should get the data from session state and display it as shown above. Now, add that code to the Load event handler.

Add an event handler for the Click event of the Send Quotation button. If the entries for this form are valid, this handler should use the data entered by the user to display a message below the buttons that says: Quotation sent to at . It should also set the values in session state to null.

MY CODE

Confirm.aspx.cs

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls;

namespace Coding0504 { public partial class Confirm : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (PreviousPage != null) { TextBox txtSalesPrice = (TextBox)PreviousPage.FindControl("txtSalesPrice"); lblSalesPrice.Text = txtSalesPrice.Text;

TextBox txtDiscountAmount = (TextBox)PreviousPage.FindControl("txDiscountAmount"); lblDiscountAmount.Text = txtDiscountAmount.Text;

TextBox txtTotalPrice = (TextBox)PreviousPage.FindControl("txtTotalPrice"); lblTotalPrice.Text = txtTotalPrice.Text; }

} } }

Confirm.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Confirm.aspx.cs" Inherits="Coding0504.Confirm" %>

Confirm quotation

Quotation confirmation

Send confirmation to

<%-- Quotation and Return buttons --%>

<%-- buttons go here --%>

<%-- message label --%>
<%-- message label goes here --%>

Default.aspx.cs

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls;

namespace Coding0504 { public partial class Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { UnobtrusiveValidationMode = UnobtrusiveValidationMode.None; }

protected void btnCalculate_Click(object sender, EventArgs e) { if (IsValid) { decimal salesPrice = Convert.ToDecimal(txtSalesPrice.Text); decimal discountPercent = Convert.ToDecimal(txtDiscountPercent.Text) / 100;

decimal discountAmount = salesPrice * discountPercent; decimal totalPrice = salesPrice - discountAmount;

lblDiscountAmount.Text = discountAmount.ToString("c"); lblTotalPrice.Text = totalPrice.ToString("c");

Session.Add("txtSalesPrice", txtSalesPrice); Session.Add("lblDiscountAmount", lblDiscountAmount); Session.Add("lblTotalPrice", lblTotalPrice); } }

protected void Confirm_Click(object sender, EventArgs e) {

Response.Redirect("/Confirm.aspx"); } } }

Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Coding0504.Default" %>

Price quotation

Price quotation

100

20

<%-- Calculate and Confirm buttons --%>

<%-- confirm button goes here --%>

<%-- message label --%>
<%-- message label goes here --%>

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

2nd Edition

1597499471, 978-1597499477

More Books

Students also viewed these Databases questions

Question

Write formal proposal requests.

Answered: 1 week ago

Question

Write an effective news release.

Answered: 1 week ago

Question

Identify the different types of proposals.

Answered: 1 week ago