Question

In: Computer Science

For your final project, you are to create a two-page web application of your choice. ASP.NET...

For your final project, you are to create a two-page web application of your choice. ASP.NET : C#

You must include the following items:

At least 5 different standard server controls

At least 2 validation controls

At least 1 navigation control ~ one must navigate back and forth to each page One session state element

Upon completion of your two-page web application, you will provide a two page report describing the functions of the web application as well as each control that you have included in your design.

Solutions

Expert Solution

Aspx.page

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

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script>
//validation
$(document).ready(function () {
$('#lnkTable').click(function () {
$('#grid').toggle();
})
$('#btnSubmit').click(function () {
var count = 0;
if ($('#txtName').val().trim() == "") {
alert("Enter the name");
return false;
}
else if ($('#txtEmail').val().trim() == "") {
alert("Enter the Email");
return false;
}
else if ($('#txtSalary').val().trim() == "") {
alert("Enter the Salary");
return false
}

});
});
</script>
</head>
<body>
<form runat="server">
<div class="container">
<asp:HyperLink ID="lnkTable" CssClass="btn-link btn pull-right" runat="server">Dispaly Table</asp:HyperLink>
<div class="row">
<div class="form-horizontal col-lg-8 col-lg-offset-2" style="margin-top: 20px">
<div class="form-group">
<label class="control-label col-sm-4">Employee Name:</label>
<div class="col-sm-8">
<asp:TextBox ID="txtName" class="form-control" runat="server"></asp:TextBox>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4">Employee Email:</label>
<div class="col-sm-8">
<asp:TextBox ID="txtEmail" class="form-control" runat="server"></asp:TextBox>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4">Employee Gender:</label>
<div class="col-sm-8">
<asp:RadioButtonList ID="rdbGender" runat="server" RepeatDirection="Horizontal">
<asp:ListItem Text="Male" Selected="True" Value="Male"></asp:ListItem>
<asp:ListItem Text="Female" Value="Female"></asp:ListItem>
</asp:RadioButtonList>

</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4">Employee Department:</label>
<div class="col-sm-8">
<asp:DropDownList ID="ddlDept" CssClass="form-control" runat="server">
<asp:ListItem Text="IT" Value="IT"></asp:ListItem>
<asp:ListItem Text="VFX" Value="VFX"></asp:ListItem>
<asp:ListItem Text="INFOMATICA" Value="INFOMATICA"></asp:ListItem>
</asp:DropDownList>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4">Salary:</label>
<div class="col-sm-8">
<asp:TextBox ID="txtSalary" class="form-control" runat="server"></asp:TextBox>
</div>
</div>

<asp:Button ID="btnSubmit" OnClick="btnSubmit_Click" CssClass="btn btn-success center-block" runat="server" Text="Submit" />
<br />
<asp:Label runat="server" Style="color: red" ID="lblRes" CssClass="center-block"></asp:Label>
</div>
</div>

<div id="grid" style="display:none">
<asp:GridView ID="GridView1" runat="server"></asp:GridView>
</div>
</div>
</form>
</body>
</html>

.CS .Page

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace samplePro
{
public partial class WebForm1 : System.Web.UI.Page
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString);
protected void Page_Load(object sender, EventArgs e)
{
BindGridView();
}

protected void BindGridView()
{
SqlCommand cmd = new SqlCommand("select * from Employee", con);
con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();

con.Close();
}

protected void btnSubmit_Click(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand("insert into Employee (EmpName, Gender,Department, Salary,Email) values('" + txtName.Text + "', '" + rdbGender.SelectedValue + "', '" + ddlDept.SelectedValue + "', '" + txtSalary.Text + "', '" + txtEmail.Text + "')", con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
lblRes.Text = "Insert Successful";
clear();
}

protected void clear()
{
txtSalary.Text = "";
txtName.Text = "";
txtEmail.Text = "";
ddlDept.SelectedIndex = 0;
rdbGender.SelectedIndex = 0;
}
}
}

add connection string in Web.config page

<connectionStrings>
<add name="DBCS" connectionString="Data Source=MITTU-PC\MITTU;Initial Catalog=Test;User ID=sa;Password=Deva@123" providerName="System.Data.SqlClient" />

</connectionStrings>


Related Solutions

Treating the two web pages as two views of a Single Page Application (SPA), create the...
Treating the two web pages as two views of a Single Page Application (SPA), create the SPA with two views, one shows what the page in any one question displays and the other shows what the page in other questions  displays
Web Application Development Course - C# Update the ASP.NET web application code by adding below functionality:...
Web Application Development Course - C# Update the ASP.NET web application code by adding below functionality: • Create a new web form called Welcome.aspx and add labels to show name, company, email, and membership. • Create a new business layer class called Customer to hold the entered user details • When the user clicks on Sign Up button and if all the validations on the page pass o Store the details entered on page in the Customer object. o Save...
For this assignment you are required to create a web page displaying a recipe of your...
For this assignment you are required to create a web page displaying a recipe of your choosing. Your submission should appropriately use the basic head and body construction of an HTML document. Additionally you are required to appropriately use at least three different HTML element types. For example you might use an unordered list for your ingredients, an ordered list for the steps of your recipe, and an image to show the final result. If you choose to use an...
In this assignment you will create a web page about your favorite sports to play or...
In this assignment you will create a web page about your favorite sports to play or teams to watch. If you don’t watch or play sports, please make up your favorite sports to play or teams to watch. You will be incorporating images into your web page, as well as other concepts learned in this unit. Create an external style sheet using a text editor of your choosing. In the CSS file add the following style rules: A background image...
C# & ASP.NET Create a console application that prompts the user to enter a regular expression,...
C# & ASP.NET Create a console application that prompts the user to enter a regular expression, and then prompts the user to enter some input and compare the two for a match until the user presses Esc: The default regular expression checks for at least one digit. Enter a regular expression (or press ENTER to use the default): ^[a- z]+$ Enter some input: apples apples matches ^[a-z]+$? True Press ESC to end or any key to try again. Enter a...
Create a mockup of your web application that will display a list of favorites. Remember, this...
Create a mockup of your web application that will display a list of favorites. Remember, this can be a list of any favorite items, such as books, movies, restaurants, music, and so on. Your web application should contain at least 3 pages (HTML documents). Your mockup should contain mockups of each HTML document. You should follow a similar format as the sample mockup provided here. Your 5-6-page document should include the following: A description of the site's organizational structure. A...
Create an empty Web Site application named Bakery. Add a new Web page named Default.aspx to the application. Change the DOCUMENT object's Title property to Meyer's.
In Visual BasicCreate an empty Web Site application named Bakery. Add a new Web page named Default.aspx to the application. Change the DOCUMENT object's Title property to Meyer's. The application should allow the user to enter two items: the number of doughnuts ordered and the number of muffins ordered. The application should should display the total number of items ordered and the total sales amount, inlcuding a 5% sales tax. A doughnut costs .50; a muffin costs .75. Save the...
You will design and create your own GUI application for the Bank project. This project should...
You will design and create your own GUI application for the Bank project. This project should be designed and written by Java programming. The requirements of the program: 1. The program will be best implemented as a multi-file program for each class. 2. The parameters and return types of each function and class member should be decided in advance. You may need to add more member variables and functions to the classes than those listed below. Also, you can throws...
1. An HTML document that’s generated by a web application is a ________________________ web page. 2....
1. An HTML document that’s generated by a web application is a ________________________ web page. 2. An easy way to log the progress of an application in Chrome’s Console panel is to insert __________________ methods at critical points in the code. 3. The childNodes property of a DOM object returns a/an ______________________ of the child nodes for that object. 4. The ___________________ method of an array can be used to concatenate the elements of the array into a single string.​...
Create an ASP.NET page and add ScriptManager and UpdatePanel controls. Next, add a SqlDataSource and DetailsView...
Create an ASP.NET page and add ScriptManager and UpdatePanel controls. Next, add a SqlDataSource and DetailsView control within the UpdatePanel and configure them so that the visitor can. add new records to the Books table. add two Label Web controls to this page—one outside the UpdatePanel and the other within the UpdatePanel. Have the Label Text properties assigned to the current date and time on each page load. When testing the page, note that when the page is first visited,...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT