Professional Documents
Culture Documents
Bahria University Islamabad: Name: Enrollment: 01-235191-089 Class: Submitted To: Sir Usman Shafique
Bahria University Islamabad: Name: Enrollment: 01-235191-089 Class: Submitted To: Sir Usman Shafique
Before starting there should be a sign up page where we register the admin and then login screen, after
successfully login next home page should be display and session should be create.so once we logout the
home page session should be removed.
1- Student name
2- Enrollment (only accept formatted)
3- Program
4- Semester
5- Mobile number (only accept formatted)
CODE:
MASTERPAGE:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="MasterPage.master.cs"
Inherits="Assignment4.MasterPage" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<h1 style="background-color: #9933FF; color: #000000; font-weight: bold;">
Student Information System</h1>
</asp:ContentPlaceHolder>
</div>
<span id ="sg" runat="server" ></span>
</form>
</body>
</html>
ADMIN.aspx:
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.Master"
AutoEventWireup="true" CodeBehind="Admin.aspx.cs" Inherits="Assignment4.WebForm1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<p style="font-size: large; font-weight: bold; font-style: italic; color: #000000;
background-color: #CC99FF">
ADMIN LOGIN</p>
<asp:TextBox ID="TextBox1" runat="server" BorderWidth="2px" Height="34px"
ontextchanged="TextBox1_TextChanged" Width="188px">Admin ID</asp:TextBox>
<p>
<asp:TextBox ID="TextBox2" runat="server" BorderWidth="2px" Height="36px"
Width="193px" ontextchanged="TextBox2_TextChanged">Passward</asp:TextBox>
</p>
<asp:Button ID="Button1" runat="server" BorderWidth="2px"
onclick="Button1_Click" Text="Login" Width="169px" />
<p>
</p>
</asp:Content>
ADMIN.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Assignment4
{
public partial class WebForm1 : System.Web.UI.Page
{
DataClasses1DataContext db = new DataClasses1DataContext();
db.Admins.InsertOnSubmit(ad);
db.SubmitChanges();
}
}
}
STUDENT_INFORMATION.aspx;
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.Master"
AutoEventWireup="true" CodeBehind="Student_Information.aspx.cs"
Inherits="Assignment4.Student_Information" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<p style="font-size: large; font-weight: bold; font-style: italic; background-color:
#CC99FF">
STUDENT INFORMATION:</p>
<asp:TextBox ID="TextBox1" runat="server" BorderWidth="2px" Width="267px">Student
Name</asp:TextBox>
<br />
<br />
<asp:TextBox ID="TextBox2" runat="server" BorderWidth="2px"
Width="266px">Enrollment(01-234678-000)</asp:TextBox>
<br />
<br />
<asp:TextBox ID="TextBox3" runat="server" BorderWidth="2px"
Width="267px">Program</asp:TextBox>
<br />
<br />
<asp:TextBox ID="TextBox4" runat="server" BorderWidth="2px"
Width="271px">Semester</asp:TextBox>
<p>
<asp:TextBox ID="TextBox5" runat="server" BorderWidth="2px" Width="272px">Mobile
Number (03xx-xxxxxxx)</asp:TextBox>
</p>
<asp:Button ID="Button1" runat="server" BorderWidth="2px" Text="Add Record"
Width="194px" onclick="Button1_Click" />
<asp:Button ID="Button2" runat="server" BorderWidth="2px" Text="Update Record"
Width="194px" onclick="Button2_Click" />
<asp:Button ID="Button3" runat="server" BorderWidth="2px" Text="Delete Record"
Width="194px" onclick="Button3_Click" />
<asp:Button ID="Button4" runat="server" onclick="Button4_Click"
Text="Show Records" Width="194px" BorderWidth="2px" />
<br />
<br />
<asp:GridView ID="GridView1" runat="server" BorderWidth="2px">
</asp:GridView>
<p>
</p>
<span id ="msg" runat="server" ></span>
</asp:Content>
STUDENT_INFORMATION.cs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Assignment4
{
public partial class Student_Information : System.Web.UI.Page
{
DataClasses1DataContext db = new DataClasses1DataContext();
if (rows.Count() != 0)
{
foreach (var t in rows)
{
Session["yourname"] = t.Student_Name;
}
Response.Redirect("Admin.aspx");
GridView1.DataSource = rows.ToList();
GridView1.DataBind();
}
else
{
db.Students.InsertOnSubmit(sd);
db.SubmitChanges();
}
db.SubmitChanges();
}
}
OUTPUT:
SHOW RECORD:
UPDATE RECORD:
}
db.SubmitChanges();
}
DELETE RECORD:
{
var rows = from s in db.Students
where s.Student_Name == TextBox1.Text
select s;
db.Students.DeleteAllOnSubmit(rows);
db.SubmitChanges();
}