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

Create a new website using C# & ASP.Net in Visual Studio: 1. Create a web page...
Create a new website using C# & ASP.Net in Visual Studio: 1. Create a web page to access a database and display the data from a table by providing an SQL statement. Create the page with these requirements:     create label, textbox and button     the textbox will capture the SQL statement     the button will process the statement and display the results 2. Add necessary data access pages to your project. 3. Display the data in Gridview
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...
 In this exercise, you will create two external style sheet files and a web page. You...
 In this exercise, you will create two external style sheet files and a web page. You will experiment with linking the web page to the external style sheets and note how the display of the page is changed. Create an external style sheet (call it format1.css) to format as follows: document background color of white, document text color of #000099, and document font family of Arial, Helvetica, or sans-serif. Hyperlinks should have a background color of gray (#CCCCCC). Configure the...
Web Projects If you are learning a web technology, you must create a new page that...
Web Projects If you are learning a web technology, you must create a new page that is web-accessible (use your individual burrow account) that includes a form with a field that allows the user to enter a number only. ● Create an input that allows a number to be entered. Only whole numbers should be allowed. ● Add a button below the input that says "Translate". ● When the button is clicked, it should grab the current number in the...
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...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT