Professional Documents
Culture Documents
CN Lab Final
WAIZ YOUSUF
200401057
EE 19 A
Task:
Create a web survey app in C# that asks for name and
cell phone number. All data submitted through web form
should be stored in a text file.
<!DOCTYPE html>
<html>
<head>
<title>Web Survey App</title>
<style type="text/css">
.auto-style1 {
font-size: x-large;
}
.auto-style2 {
text-align: left;
background-color: #003399;
}
.newStyle1 {
font-family: Fixedsys;
}
.newStyle2 {
font-family: Verdana;
}
.newStyle3 {
font-family: Verdana;
}
.auto-style3 {
background-color: #FFFFFF;
}
.auto-style5 {
background-color: #FFFFFF;
}
.auto-style6 {
color: #FFFFFF;
font-weight: 700;
font-size: x-large;
background-color: #0066FF;
}
.auto-style7 {
color: #FFFFFF;
background-color: #6699FF;
}
</style>
</head>
<body style="height: 150px">
<form id="Form1" runat="server" class="auto-style1">
<div class="auto-style2">
<div class="auto-style2">
<label for="txtName" class="newStyle3"><span class="auto-style7">Enter your
Name:</span></label>
<asp:TextBox ID="txtName" runat="server" required CssClass="auto-style5"
Height="19px" Width="136px"></asp:TextBox>
</div>
<div class="auto-style2">
<span class="newStyle2">
<label for="txtCellPhone"><span class="auto-style7">Enter your Phone
Number:</span></label></span>
<asp:TextBox ID="txtCellPhone" runat="server" required pattern="\d{10}"
CssClass="auto-style3" Height="22px" Width="142px"></asp:TextBox>
</div>
<br />
 
; &nbs
p;
Design View
namespace WebSurveyApp
{
public partial class Default : Page
{
protected void btnSubmit_Click(object sender, EventArgs e)
{
string name = txtName.Text;
string cellPhoneNumber = txtCellPhone.Text;
Response.Redirect("ThankYou.aspx");
}
}
}
ThankYou Page Design code
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ThankYou.aspx.cs"
Inherits="WebSurveyApp.ThankYou" %>
<!DOCTYPE html>
<html>
<head>
<title>Thank You</title>
<style type="text/css">
.auto-style1 {
font-weight: normal;
text-decoration: underline;
color: #000000;
}
.auto-style3 {
font-size: larger;
background-color: #CCCCCC;
}
.auto-style4 {
color: #000000;
font-size: x-large;
width: 437px;
background-color: #C0C0C0;
}
</style>
</head>
<body>
<h1 class="auto-style1"><strong><span class="auto-style3">Thank
You!</span></strong></h1>
<p class="auto-style4">Your survey has been submitted successfully.</p>
<!DOCTYPE html>
<html>
<head>
<title>Phone Number Search</title>
<style type="text/css">
.auto-style1 {
font-style: italic;
color: #000066;
font-size: xx-large;
background-color: #CCFFFF;
}
.auto-style2 {
color: #000066;
}
.auto-style3 {
color: #000066;
font-size: xx-large;
background-color: #FFFF99;
}
.auto-style4 {
font-size: xx-large;
background-color: #66CCFF;
}
.auto-style5 {
text-align: center;
}
.auto-style6 {
font-weight: normal;
}
.auto-style7 {
background-color: #99CCFF;
}
.auto-style8 {
font-style: italic;
color: #000066;
font-size: xx-large;
background-color: #FFCCFF;
}
</style>
</head>
<body>
<form id="Form1" runat="server">
<div class="auto-style5">
<span class="auto-style2">
<label for="txtName"><span class="auto-style4"><strong class="auto-
style6"><span class="auto-style7">Enter Name:</span></strong></span></label></span> <em>
<asp:TextBox ID="txtName" runat="server" CssClass="auto-style8" Height="35px"
Width="237px"></asp:TextBox>
</em>
</div>
<p class="auto-style5">
</body>
</html>
Design View
Searching Code
using System;
using System.IO;
using System.Web.UI;
namespace PhoneNumberSearchApp
{
public partial class Default : Page
{
protected void btnSearch_Click(object sender, EventArgs e)
{
string nameToSearch = txtName.Text;
if (phoneNumber != null)
{
lblResult.Text = "Phone number of " + nameToSearch + " : " +
phoneNumber + "";
}
else
{
lblResult.Text = "Phone number not found.";
}
}
}
}
Results