0% found this document useful (0 votes)
87 views15 pages

A Design Multiform Web Project With Following Menus: Home Courses, Departments, Staff 1. Home Page (Default - Aspx)

The document describes a university web portal project with multiple pages (home, courses, departments, staff profiles, alumni, downloads) built using ASP.NET and ADO.NET. Each page retrieves and displays data from a database using a DataAccess class. The home page links to all other pages. The other pages each display a GridView control populated with data from their respective database tables.

Uploaded by

deepak218015
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
87 views15 pages

A Design Multiform Web Project With Following Menus: Home Courses, Departments, Staff 1. Home Page (Default - Aspx)

The document describes a university web portal project with multiple pages (home, courses, departments, staff profiles, alumni, downloads) built using ASP.NET and ADO.NET. Each page retrieves and displays data from a database using a DataAccess class. The home page links to all other pages. The other pages each display a GridView control populated with data from their respective database tables.

Uploaded by

deepak218015
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

A design multiform web project with following menus: home courses, departments, staff

profile, alumni and download using ado.net

1. Home Page (Default.aspx):


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="YourNamespace._Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>Home Page</title>

</head>

<body>

<form id="form1" runat="server">

<div>

<!-- Home Page Content -->

<h1>Welcome to the University Portal</h1>

<!-- Add links to other pages -->

<ul>

<li><a href="Courses.aspx">Courses</a></li>

<li><a href="Departments.aspx">Departments</a></li>

<li><a href="StaffProfile.aspx">Staff Profile</a></li>

<li><a href="Alumni.aspx">Alumni</a></li>

<li><a href="Downloads.aspx">Downloads</a></li>

</ul>

</div>

</form>

</body>

</html>
2. Courses Page (Courses.aspx):
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Courses.aspx.cs"
Inherits="YourNamespace.Courses" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>Courses</title>

</head>

<body>

<form id="form1" runat="server">

<div>

<h1>Courses</h1>

<asp:GridView ID="GridViewCourses" runat="server" AutoGenerateColumns="false">

<Columns>

<asp:BoundField DataField="CourseID" HeaderText="Course ID"


SortExpression="CourseID" />

<asp:BoundField DataField="CourseName" HeaderText="Course Name"


SortExpression="CourseName" />

<asp:BoundField DataField="Department" HeaderText="Department"


SortExpression="Department" />

</Columns>

</asp:GridView>

</div>

</form>

</body>

</html>

using System;

using System.Data;
using System.Web.UI;

public partial class Courses : Page

private readonly DataAccess dataAccess = new DataAccess();

protected void Page_Load(object sender, EventArgs e)

if (!IsPostBack)

BindCourses();

private void BindCourses()

try

DataTable coursesTable = dataAccess.GetCourses();

if (coursesTable.Rows.Count > 0)

GridViewCourses.DataSource = coursesTable;

GridViewCourses.DataBind();

else

// Display a message if there are no courses

Response.Write("No courses found.");


}

catch (Exception ex)

// Handle exceptions, log errors, or display an error message

Response.Write($"Error: {ex.Message}");

Departments.aspx (ASPX file):


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

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>Departments</title>

</head>

<body>

<form id="form1" runat="server">

<div>

<h1>Departments</h1>

<asp:GridView ID="GridViewDepartments" runat="server" AutoGenerateColumns="false">

<Columns>

<asp:BoundField DataField="DepartmentID" HeaderText="Department ID"


SortExpression="DepartmentID" />

<asp:BoundField DataField="DepartmentName" HeaderText="Department Name"


SortExpression="DepartmentName" />

<asp:BoundField DataField="HeadOfDepartment" HeaderText="Head of Department"


SortExpression="HeadOfDepartment" />
</Columns>

</asp:GridView>

</div>

</form>

</body>

</html>

using System;

using System.Data;

using System.Web.UI;

public partial class Departments : Page

private readonly DataAccess dataAccess = new DataAccess();

protected void Page_Load(object sender, EventArgs e)

if (!IsPostBack)

BindDepartments();

private void BindDepartments()

try

DataTable departmentsTable = dataAccess.GetDepartments();


if (departmentsTable.Rows.Count > 0)

GridViewDepartments.DataSource = departmentsTable;

GridViewDepartments.DataBind();

else

// Display a message if there are no departments

Response.Write("No departments found.");

catch (Exception ex)

// Handle exceptions, log errors, or display an error message

Response.Write($"Error: {ex.Message}");

StaffProfile.aspx (ASPX file):


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

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>Staff Profile</title>

</head>

<body>

<form id="form1" runat="server">


<div>

<h1>Staff Profile</h1>

<asp:GridView ID="GridViewStaff" runat="server" AutoGenerateColumns="false">

<Columns>

<asp:BoundField DataField="StaffID" HeaderText="Staff ID" SortExpression="StaffID" />

<asp:BoundField DataField="StaffName" HeaderText="Staff Name"


SortExpression="StaffName" />

<asp:BoundField DataField="Department" HeaderText="Department"


SortExpression="Department" />

<asp:BoundField DataField="Position" HeaderText="Position" SortExpression="Position" />

</Columns>

</asp:GridView>

</div>

</form>

</body>

</html>

using System;

using System.Data;

using System.Web.UI;

public partial class StaffProfile : Page

private readonly DataAccess dataAccess = new DataAccess();

protected void Page_Load(object sender, EventArgs e)

if (!IsPostBack)

{
BindStaffProfiles();

private void BindStaffProfiles()

try

DataTable staffTable = dataAccess.GetStaffProfiles();

if (staffTable.Rows.Count > 0)

GridViewStaff.DataSource = staffTable;

GridViewStaff.DataBind();

else

// Display a message if there are no staff profiles

Response.Write("No staff profiles found.");

catch (Exception ex)

// Handle exceptions, log errors, or display an error message

Response.Write($"Error: {ex.Message}");

}
Alumni Page (Alumni.aspx)
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Alumni.aspx.cs"
Inherits="YourNamespace.Alumni" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>Alumni</title>

</head>

<body>

<form id="form1" runat="server">

<div>

<h1>Alumni</h1>

<asp:GridView ID="GridViewAlumni" runat="server" AutoGenerateColumns="false">

<Columns>

<asp:BoundField DataField="AlumniID" HeaderText="Alumni ID"


SortExpression="AlumniID" />

<asp:BoundField DataField="AlumniName" HeaderText="Alumni Name"


SortExpression="AlumniName" />

<asp:BoundField DataField="GraduationYear" HeaderText="Graduation Year"


SortExpression="GraduationYear" />

<asp:BoundField DataField="CurrentJob" HeaderText="Current Job"


SortExpression="CurrentJob" />

</Columns>

</asp:GridView>

</div>

</form>

</body>

</html>

using System;
using System.Data;

using System.Web.UI;

public partial class Alumni : Page

private readonly DataAccess dataAccess = new DataAccess();

protected void Page_Load(object sender, EventArgs e)

if (!IsPostBack)

BindAlumni();

private void BindAlumni()

try

DataTable alumniTable = dataAccess.GetAlumni();

if (alumniTable.Rows.Count > 0)

GridViewAlumni.DataSource = alumniTable;

GridViewAlumni.DataBind();

else

// Display a message if there are no alumni records


Response.Write("No alumni records found.");

catch (Exception ex)

// Handle exceptions, log errors, or display an error message

Response.Write($"Error: {ex.Message}");

Downloads Page (Downloads.aspx):


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

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>Downloads</title>

</head>

<body>

<form id="form1" runat="server">

<div>

<h1>Downloads</h1>

<asp:GridView ID="GridViewDownloads" runat="server" AutoGenerateColumns="false">

<Columns>

<asp:BoundField DataField="FileID" HeaderText="File ID" SortExpression="FileID" />

<asp:BoundField DataField="FileName" HeaderText="File Name"


SortExpression="FileName" />

<asp:HyperLinkField DataNavigateUrlFields="FilePath"
DataNavigateUrlFormatString="~/Downloads/{0}" HeaderText="Download" Text="Download" />
</Columns>

</asp:GridView>

</div>

</form>

</body>

</html>

using System;

using System.Data;

using System.Web.UI;

public partial class Downloads : Page

private readonly DataAccess dataAccess = new DataAccess();

protected void Page_Load(object sender, EventArgs e)

if (!IsPostBack)

BindDownloads();

private void BindDownloads()

try

DataTable downloadsTable = dataAccess.GetDownloads();


if (downloadsTable.Rows.Count > 0)

GridViewDownloads.DataSource = downloadsTable;

GridViewDownloads.DataBind();

else

// Display a message if there are no downloadable items

Response.Write("No downloadable items found.");

catch (Exception ex)

// Handle exceptions, log errors, or display an error message

Response.Write($"Error: {ex.Message}");

Code-Behind for Data Access (DataAccess.cs):


using System.Data;

using System.Data.SqlClient;

public class DataAccess

private readonly string connectionString = "YourConnectionString";

public DataTable GetCourses()

using (SqlConnection connection = new SqlConnection(connectionString))


{

connection.Open();

using (SqlCommand command = new SqlCommand("SELECT * FROM Courses", connection))

SqlDataAdapter adapter = new SqlDataAdapter(command);

DataTable dataTable = new DataTable();

adapter.Fill(dataTable);

return dataTable;

// Similar methods for other entities (Departments, Staff, Alumni, Downloads)

Code-Behind for Courses Page (Courses.aspx.cs):


using System;

using System.Web.UI;

public partial class Courses : Page

private readonly DataAccess dataAccess = new DataAccess();

protected void Page_Load(object sender, EventArgs e)

if (!IsPostBack)

BindCourses();

}
private void BindCourses()

// Use dataAccess.GetCourses() to retrieve data and bind it to your UI controls

// Example: DataTable coursesTable = dataAccess.GetCourses();

// YourGridView.DataSource = coursesTable;

// YourGridView.DataBind();

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy