Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How to accomplish something like this using ASP .NET Web Forms? clicking this bu

ID: 3812194 • Letter: H

Question

How to accomplish something like this using ASP.NET Web Forms?

clicking this button ateway will allow the user to School Account.com add a new student. It will take you to figure 4.2. See page Add student 4 for details My Students First Name Last Name Student Id School Name Clicking this This is a table grows, button will take No records found when input from to the main figure 4.2. Initially Ok page. "No records Found" Figure 4.1 Initially, there are no students. So you must show the message "No Records Found". gateway School Account.com Gray out this button CAdd student My Students or disable click activity when New Student Information entering a new student Student First Name Student Last Name Regular Text Boxes Clicking this with proper icons as button will take student shown to figure 4.1 hool Name Clicking "Add to Cancel Add to List List". See details next page. Figure 4.2

Explanation / Answer

MyStudents.aspx.cs
======================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication22
{
public partial class MyStudents : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}

protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("~/AddStudents.aspx/");
}

protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("~/Home.aspx/");
}
}
}

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

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>

<style>
header{
background-color:maroon;
text-align:center;
color:#fff;
font-size:36px;
}
.mainhead1{
background-color:rgba(255, 165, 0, 0.77);
color:#fff;
padding:10px 20px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<header>
GatewaySchoolAccount.Com
</header>
<div class="row mainhead1" >
<div class="col-md-6">MyStudents</div>
<div class="col-md-6"><asp:Button ID="Button1" runat="server" Text="AddStudents" class="btn btn-success"/></div>
</div>

  
<div class="container">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="GatewayGridId" DataSourceID="SqlDataSource1" CssClass="table table-bordered" emptydatatext="No Records Found....">
<Columns>
<asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />
<asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" />
<asp:BoundField DataField="Student_Id" HeaderText="Student_Id" SortExpression="Student_Id" />
<asp:BoundField DataField="SchoolName" HeaderText="SchoolName" SortExpression="SchoolName" />
</Columns>
</asp:GridView>
</div>
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DB %>" SelectCommand="SELECT * FROM [tbl_studentGrid]"></asp:SqlDataSource>
<div class="mainhead1"> <asp:Button ID="Button2" runat="server" Text="OK" class="btn btn-info"/></div>
  
</form>
<link rel="stylesheet" href="../Content/bootstrap.min.css" type="text/css" />
<script src="../Scripts/jquery-1.10.2.min.js"></script>
<script src="../Scripts/bootstrap.min.js"></script>
</body>
</html>


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

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style>
body{
margin:0px;
}
header{
background-color:maroon;
text-align:center;
color:#fff;
font-size:36px;
}
.mainhead1{
background-color:rgba(255, 165, 0, 0.77);
color:#fff;
padding:10px 20px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<header>
GatewaySchoolAccount.Com
</header>
<div class="row mainhead1" >
<div class="col-md-6">MyStudents</div>
<div class="col-md-6"><asp:Button ID="Button2" runat="server" Text="AddStudents" class="btn btn-default"/></div>
</div>
<div class="container">
<h3>New Student Information</h3>

<div class="form-group">
<div class="input-group">
<div class="input-group-addon">
<span class="glyphicon glyphicon-user"></span>
</div>
<asp:TextBox ID="TextBox1" runat="server" placeholder="First Name" CssClass="form-control"></asp:TextBox>
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-addon">
<span class="glyphicon glyphicon-user"></span>
</div>
<asp:TextBox ID="TextBox2" runat="server" placeholder="Last Name" CssClass="form-control"></asp:TextBox>
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-addon">
<span class="glyphicon glyphicon-user"></span>
</div>
<asp:TextBox ID="TextBox3" runat="server" placeholder="Student Id" CssClass="form-control"></asp:TextBox>
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-addon">
<span class="glyphicon glyphicon-user"></span>
</div>
<asp:TextBox ID="TextBox4" runat="server" placeholder="School Name" CssClass="form-control"></asp:TextBox>
</div>
</div>


</div>
<div class="mainhead1">
<asp:Button ID="Button4" runat="server" Text="Cancel" CssClass="btn btn-primary"/>
<asp:Button ID="Button5" runat="server" Text="AddToList" CssClass="btn btn-primary"/>
</div>
</form>
<link rel="stylesheet" href="../Content/bootstrap.min.css" type="text/css" />
<script src="../Scripts/jquery-1.10.2.min.js"></script>
<script src="../Scripts/bootstrap.min.js"></script>
</body>
</html>

AddStudents.aspx.cs
===================
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 WebApplication22
{
public partial class AddStudents : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Button2.Enabled = false;
}

protected void Button2_Click(object sender, EventArgs e)
{

}

protected void TextBox2_TextChanged(object sender, EventArgs e)
{

}

protected void Button5_Click(object sender, EventArgs e)
{//Add To List
string s = ConfigurationManager.ConnectionStrings["DB"].ConnectionString;
SqlConnection cn = new SqlConnection(s);
cn.Open();
SqlCommand cmd = new SqlCommand("Insert into tbl_studentGrid (FirstName,LastName,Student_Id,SchoolName)VALUES('"+TextBox1.Text+ "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "')",cn);
cmd.ExecuteNonQuery();
cn.Close();
Response.Redirect("~/Mystudents.aspx/");
}

protected void Button4_Click(object sender, EventArgs e)
{
Response.Redirect("~/Mystudents.aspx/");
}
}
}

Home.Aspx

=========

Home page

dbscript:

======

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_studentGrid](
[GatewayGridId] [int] IDENTITY(1,1) NOT NULL,
[FirstName] [nvarchar](max) NULL,
[LastName] [nvarchar](max) NULL,
[Student_Id] [nvarchar](50) NULL,
[SchoolName] [nchar](10) NULL,
CONSTRAINT [PK_tbl_studentGrid] PRIMARY KEY CLUSTERED
(
[GatewayGridId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote