0% found this document useful (0 votes)
21 views8 pages

Lab 3 Scheme

The document provides instructions for two tasks - modifying a Google account registration form and creating a webpage to calculate prices for an online used book store. For the first task, the form is to be modified by replacing certain controls, adding a "Check" button to validate password matching, and displaying entered details. For the second task, a webpage is to be created using dropdown lists to select books, displaying individual prices, and calculating subtotals and grand totals with and without GST.

Uploaded by

NURATIQAH HILMY
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views8 pages

Lab 3 Scheme

The document provides instructions for two tasks - modifying a Google account registration form and creating a webpage to calculate prices for an online used book store. For the first task, the form is to be modified by replacing certain controls, adding a "Check" button to validate password matching, and displaying entered details. For the second task, a webpage is to be created using dropdown lists to select books, displaying individual prices, and calculating subtotals and grand totals with and without GST.

Uploaded by

NURATIQAH HILMY
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

LAB 3

PREPARED BY DR ZURIANI MUSTAFFA


Q1. Figure 1 shows Google Account registration form. Assumed that you are hired to modify the given form:

i. Replace the highlighted web controls (in red-dashed box) with another suitable web controls.
ii. Add another button, name ‘Check’ to check whether both TextBoxes for ‘Create a password’
and ‘Confirm your password’ are entered with same input. Refer Figure 3 and 4 for example of
the output. You may use provided image in KALAM as your Button (OK.png and NOT.png)

Later, by using postback approach, write a C# code to display all the entered input by the user. For CSS,
please refer to Table 1. Example of the output is as shown in Figure 2.

Table 1: CSS

Item Feature
Background image background.png
Font family Papyrus
Border style Ridge

Use provided image in KALAM

Figure 1: Google Account Registration Form

1
Display LastName here

Figure 2: Example of the output

Figure 3: If Both ‘Create a password’ and ‘Confirm your password’ are equal, when Check button is
clicked, the above image will appear.

Figure 4: If Both ‘Create a password’ and ‘Confirm your password’ are not equal, when Check button is
clicked, the above image will appear.

2
Answer:

3
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
LblGreet.Text = "Hi "+ TBLastName.Text + ". The followings are your details.";
LblName.Text = "Name :";
LblName0.Text = TBFirstName.Text + " " + TBLastName.Text;

LblUsername.Text = "Username :";


LblUsername0.Text = TBUsername.Text;

LblDOB.Text = "D.O.B : ";


LblDOB0.Text = Calendar1.SelectedDate.ToShortDateString();

LblGender.Text = "Gender :";


LblGender0.Text = RadioButtonList1.SelectedItem.Text;

LblPhone.Text = "Mobile Phone :";


LblPhone0.Text = TBPhone.Text;

LblEmail.Text = "Current Email :";


LblEmail0.Text = TBEmail.Text;

LblLocation.Text = "Location :";


LblLocation0.Text = DropDownList1.Text;

}
protected void Button1_Click(object sender, EventArgs e)
{
if (TBPassword.Text != TBPassword0.Text)
{
Image1.ImageUrl = "NOT.png";
}
else
{
Image1.ImageUrl = "OK.png";
}

Q2. Create a webpage for Used Books Online Store which will calculate the total amount that has to be
paid by the customer. When the item is selected, the price of the item will be displayed next to the
DropDownList (enable AutoPostBack of the DropDownList). Later, create a function to calculate the total
price (without 6% GST) and grand total of the price (inclusive of 6% GST) for the selected items (see Table
1). The price of the selected items are collected using DropDownList (see Figure 5 for example). Example
of the output is as shown in Figure 6.

Category Book Title Price (RM)


Classic Shakepeare’s Sonnets 100
Many-Storied House: Poems 125
The Second Jungle Book 65
Fiction Standing on the Promises 90
High Crimes 70

4
Sherlock Holmes 90
Science and Fantasy Living Forever 100
Galaxy Jane 80
Planet of Exile 90

Item
Price

Figure 5: DropDownList

5
The price of the selected item will be
displayed here whenever the item in the
DropDownList is selected.

***Enable AutoPostBack in DropDownList

Figure 6: Example of the output


public partial class Q2 : System.Web.UI.Page
{
double Calculate()
{
double price1 = Convert.ToDouble(DropDownList1.SelectedValue);
double price2 = Convert.ToDouble(DropDownList2.SelectedValue);
double price3 = Convert.ToDouble(DropDownList3.SelectedValue);
double total, grandtotal;

total = price1 + price2 + price3;


grandtotal = (0.06 * total) + total;

LblWithoutGST.Text = "Total (Exclude 6% GST) : RM ";


LblWithoutGST0.Text = total.ToString();

LblWithGST.Text = "Total (include 6% GST) : RM ";


LblWithGST0.Text = grandtotal.ToString();

return 0;
}

6
protected void Page_Load(object sender, EventArgs e)
{

if (DropDownList1.Text == "0")
{
LblPrice1.Text = "Please select an item";
}
else
{
LblPrice1.Text = DropDownList1.SelectedValue;
}

if (DropDownList2.Text == "0")
{
LblPrice2.Text = "Please select an item";
}
else
{
LblPrice2.Text = DropDownList2.SelectedValue;
}

if (DropDownList3.Text == "0")
{
LblPrice3.Text = "Please select an item";
}
else
{
LblPrice3.Text = DropDownList3.SelectedValue;
}
}
protected void Button1_Click(object sender, EventArgs e)
{

Calculate();
}
}

You might also like