Extra 4-1 Enhance the the Quotation application The application for this exercis
ID: 639643 • Letter: E
Question
Extra 4-1 Enhance the the Quotation application
The application for this exercise is an enhanced version of the one for exercise 3-1. First, the Quotation has a confirm button to the right of the Calculate button. Second, the Confirm button redirects to a Confirmation page.
The Quotation page (Default.aspx)
The Confirmation page (Confirm.aspx)
Open the web site for this exercise and start enhancing its pages
Open the web site named XEx04Quotation in your exercises_extra folder. It includes the aspx and code behind files for the pages shown above, but the first page doesn
Explanation / Answer
Confirm.aspx-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Confirm.aspx.cs" Inherits="Confirm" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Confirm quotation</title>
<link href="Styles.css" rel="stylesheet" />
</head>
<body>
<form id="form1" runat="server">
<h1>Quotation confirmation</h1>
<label>Sales price</label><asp:Label ID="lblSalesPrice" runat="server" CssClass="result"></asp:Label><br /><br />
<label>Discount amount</label><asp:Label ID="lblDiscountAmount" runat="server" CssClass="result"></asp:Label><br /><br />
<label>Total price</label><asp:Label ID="lblTotalPrice" runat="server" CssClass="result"></asp:Label><br />
<h2>Send confirmation to</h2>
<label>Name</label>
<asp:TextBox ID="txtName" runat="server" CssClass="entry"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtName" Display="Dynamic" ErrorMessage="RequiredFieldValidator" CssClass="validator">Required</asp:RequiredFieldValidator><br />
<label>Email address</label>
<asp:TextBox ID="txtEmail" runat="server" CssClass="entry"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtEmail" Display="Dynamic" ErrorMessage="RequiredFieldValidator" CssClass="validator">Required</asp:RequiredFieldValidator><br />
<asp:Button ID="btnSendQuot" runat="server" Text="Send Quotation"
CssClass="button" />
<asp:Button ID="btnReturn" runat="server" Text="Return"
CssClass="button" CausesValidation="False" /><br />
<asp:Label ID="lblMessage" runat="server" Text="" ></asp:Label>
</form>
</body>
</html>
confirm.aspx.cs-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Confirm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
UnobtrusiveValidationMode = System.Web.UI.UnobtrusiveValidationMode.None;
if (Session["SalesPrice"] != null)
{
lblSalesPrice.Text = Convert.ToDecimal(Session["SalesPrice"]).ToString("c");
lblDiscountAmount.Text = Convert.ToDecimal(Session["DiscountAmt"]).ToString("c");
lblTotalPrice.Text = Convert.ToDecimal(Session["TotalPrice"]).ToString("c");
}
else
lblMessage.Text = "Click the Send Quotation button to send the quotation via email.";
}
protected void btnSendQuot_Click(object sender, EventArgs e)
{
lblMessage.Text = "This function hasn
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.