0% found this document useful (0 votes)
63 views

Lab Record

The document describes steps for installing .NET Framework and Visual Studio 2013 on a system to enable application development. It also provides code for a basic "Hello World" console app in C# using Visual Studio. Finally, it details the design of an ASP.NET GUI form with input fields for efficient student attendance management. The form allows entry of student name, course, year, date and attendance status, then displays the input on submit.

Uploaded by

iamchirec
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views

Lab Record

The document describes steps for installing .NET Framework and Visual Studio 2013 on a system to enable application development. It also provides code for a basic "Hello World" console app in C# using Visual Studio. Finally, it details the design of an ASP.NET GUI form with input fields for efficient student attendance management. The form allows entry of student name, course, year, date and attendance status, then displays the input on submit.

Uploaded by

iamchirec
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

ASP.

NET LAB RECORD

1. Installing .NetFramework
Aim: Enable seamless cross-platform application development and execution by installing
the .NET Framework.

Description:
Installing the .NET Framework involves the deployment of a comprehensive software
framework developed by Microsoft, providing a runtime environment for executing and
managing applications across various platforms. This framework supports multiple
programming languages and facilitates the development of robust, scalable, and secure
applications. The installation process includes downloading and configuring the necessary
components to empower developers to create versatile applications that run efficiently on
Windows, macOS, and Linux.

Step – 1: Check Current Version:


Ensure you don't already have the required version of the .NET Framework installed on your
system. You can check this in the "Programs and Features" section in the Control Panel.
1. Press Win + R, type control, and press Enter to launch Control Panel.
2. Click on Programs > Programs and Features.
3. From the left pane, select Turn Windows features on or off.
4. You'll see .NET 3.5 at the top of the list of Windows features. If the box besides .NET 3.5 is
shaded in black, it's installed.

If the box beside .NET Framework 3.5 is not shaded in black, that means it is not installed on
your computer.
Step – 2: Download .NET Framework:
Visit the official Microsoft website or use a trusted source to download the specific version
of the .NET Framework you need.
Here is the link: https://dotnet.microsoft.com/en-us/download/dotnet-framework
Once you click on the official website, it will open and you will see the framework versions.
You can download the latest version from the list.

Step – 3: Unblock the .exe file


Go to downloads and click on downloaded exe file

Select the check box and then click on install. It will take some time to complete the process.
After successful installation you will get the following dialogue box.

2. Installing Visual Studio2013


Aim: Facilitate efficient software development through the installation of Visual Studio 2013,
providing a robust integrated development environment (IDE) for creating diverse
applications.

Description:
Installing Visual Studio 2013 involves setting up a comprehensive IDE equipped with
powerful tools for coding, debugging, and testing. This version supports a variety of
programming languages, streamlining the development process and offering features that
enhance collaboration and productivity among developers. Follow the step-by-step wizard
to configure the IDE, enabling seamless project creation and management for building
innovative software solutions.

Prerequisites
The following system requirements are required to install Visual Studio Community 2013
into your system.

Operation System:
Windows 8.1, 8 and Windows 7 SP1

Hardware Requirements:
1.6 GHz or faster processor
1 GB of RAM
20 GB of free hard disk space
5400 RPM hard disk drive
DirectX 9-Capable Video card with 1024x768 of minimum resolution

To install the Visual Studio Community 2013, you need to use the following
procedure to complete the installation.

Step 1
Click on the following URL [Visual Studio Community 2013] and you will be shown the
following screen.

Step 2
Click on the Download button and an installer file will start downloading to your system.

Step 3

After the file is completely downloaded on your system, click on the file and run the setup.
An important point to note here is Visual Studio demands a minimum of 9 GB space to be
available somewhere in all your partitions. Please ensure this requirement to continue with
the installation.
Check the “I agree” checkbox and you'll be shown the Next button on the bottom-right of
the wizard. Click it to proceed.

Step 4
Choose from the following options to install the specific or complete features. It is a best
practice to install all the features, still you can choose depending on your requirements and
click Install.
Step 5

The installation process takes some time to download the useful resources and other files
from the internet to complete the installation depending upon the speed of your internet
connection. During my installation, it took just 1 hour to complete the installation.

Step 6
After the setup is finished installing Visual Studio Community 2013 on your machine, it
shows the following window. Click on “Launch” to launch Visual Studio.
Step 7
When you're done with your development settings, click Start Visual Studio and voila, you
are ready to play with the fully functional Visual Studio Community 2013 for free.

3. Hello world in VisualStudio


AIM: To implement a basic "Hello, World!" program in Visual Studio using C# for
introductory understanding of console applications.

DESCRIPTION:
The aim of this experiment is to introduce the fundamental concepts of programming
using Visual Studio and C#. The objective is to create a simple console application
that outputs the message "Hello, World!" when executed. This exercise serves as an
initial hands-on experience for students to become familiar with the development
environment, syntax, and basic structure of a C# program. Through this introductory
exercise, participants will gain practical insights into the process of coding, compiling,
and running a basic program, laying the foundation for more complex programming
concepts in subsequent experiments.

Source Code:
HelloWorld.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace helloworld_prog1
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
}
}
}

OUTPUT:

4. GUI form Design for studentattendance


AIM: Develop a user-friendly GUI form in ASP.NET for efficient student attendance
management.
DESCRIPTION:
This laboratory session focuses on the practical implementation of a graphical user interface
(GUI) form for student attendance management in an ASP.NET environment. The aim is to
design an intuitive and responsive interface that facilitates the seamless input and tracking
of student attendance data. Through the utilization of ASP.NET, participants will gain hands-
on experience in creating a user-friendly form, incorporating elements such as input fields
and buttons for efficient data entry and retrieval. This exercise aims to enhance the usability
of the attendance management system, ensuring an optimal user experience for educators
and administrators. Participants will delve into the intricacies of ASP.NET development,
reinforcing their understanding of web-based GUI design principles.
Souce Code:
attendanceform.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="attendanceform.aspx.cs"
Inherits="StudentsAttendance.attendanceform" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<h2>Studence Attendance Form</h2>
<form id="form1" runat="server">
<div>
<label for="studentName">Student Name:</label>
<asp:TextBox ID="studentName" runat="server" required="required"></asp:TextBox>
</div>
<br/>
<div>
<label for="course">Course:</label>
<asp:DropDownList ID="course" runat="server" >

<asp:ListItem Value="">Select</asp:ListItem>

<asp:ListItem>BCA </asp:ListItem>

<asp:ListItem>BBA</asp:ListItem>

<asp:ListItem>BCOM</asp:ListItem>

</asp:DropDownList>
</div>
<br/>
<div>
<label for="year">Batch / Year:</label>
<asp:DropDownList ID="year" runat="server" >
<asp:ListItem Value="">Select</asp:ListItem>
<asp:ListItem>I </asp:ListItem>
<asp:ListItem>II</asp:ListItem>

<asp:ListItem>III</asp:ListItem>
</asp:DropDownList>
</div>
<br/>
<div>
<label for="date">Date:</label>
<asp:Calendar ID="Calendar" runat="server"></asp:Calendar>
</div>
<br/>
<div>
<label for="status">Attendance:</label>
<asp:DropDownList ID="status" runat="server" >
<asp:ListItem Value="">Select</asp:ListItem>
<asp:ListItem>Present </asp:ListItem>
<asp:ListItem>Absent</asp:ListItem>
</asp:DropDownList>
</div>
<br/>
<div>
<asp:Label ID="resultLabel" runat="server" Text=""></asp:Label>
</div>
<br/>
<div>
<asp:Button ID="submitAttendance" runat="server" Text="Submit"
OnClick="SubmitAttendance_Click" />
</div>
</form>
</body>
</html>

attendanceform.aspx.cs

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

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

}
protected void SubmitAttendance_Click(object sender, EventArgs e)
{
string studentNameValue = studentName.Text;
string dateValue = Calendar.SelectedDate.ToShortDateString();
course.Text = course.SelectedValue;
string courseValue = course.Text;
year.Text = year.SelectedValue;
string yearValue = year.Text;
string presentValue =status.SelectedValue;
string result = $"Student Name: {studentNameValue}<br />Course: {courseValue}<br
/>Batch / Year: {yearValue}<br />Date: {dateValue}<br />Present: {presentValue}";
resultLabel.Text = result;
}
}
}

OUTPUT:

5. GUI form design FormControls


AIM: Implement an ASP.NET GUI form with diverse Form Controls for comprehensive user
interaction.
DESCRIPTION:
This lab session is dedicated to the practical exploration of GUI form design in ASP.NET, with
a specific focus on incorporating diverse Form Controls. The aim is to develop an interactive
and user-friendly interface by integrating elements such as textboxes, buttons, and
dropdowns. Participants will gain hands-on experience in utilizing these Form Controls to
facilitate seamless user interaction, ensuring efficient data input and enhancing the overall
usability of ASP.NET applications. Through this exercise, students will deepen their
understanding of Form Control properties and functionalities, preparing them for more
complex web development challenges.

SOURCE CODE
FormControls.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FormControls.aspx.cs"
Inherits="FormControls.FormControls" %>
<!DOCTYPE html>

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

<head runat="server">

<title></title>

<style type="text/css">

.auto-style1 {

width: 100%;

.auto-style2 {

margin-left: 0px;

.auto-style3 {

width: 121px;

</style>

</head>

<body>

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

<div>

<h2>Form Controls</h2>

<table class="auto-style1">

<tr>

<td class="auto-style3">

<asp:Label ID="User" runat="server" Text="Student Name"></asp:Label></td>

<td>

<asp:TextBox ID="UserName" runat="server" CssClass="auto-


style2"></asp:TextBox></td>

</tr>
<tr>

<td class="auto-style3">

<asp:Label ID="Label1" runat="server" Text="Gender"></asp:Label></td>

<td>

<asp:RadioButton ID="RadioButton3" runat="server" Text="Male"


GroupName="gender" />

<asp:RadioButton ID="RadioButton4" runat="server" Text="Female"


GroupName="gender" /></td>

</tr>

<tr>

<td class="auto-style3">

<asp:Label ID="upload" runat="server" Text="Upload a File"></asp:Label></td>

<td>

<asp:FileUpload ID="FileUpload1" runat="server" /></td>

</tr>

<tr><td class="auto-style3">

<asp:Label ID="link" runat="server"


Text="CollegeWebAddress:"></asp:Label></td>

<td>

<asp:HyperLink ID="HyperLink1" runat="server" Text="FSB-Madhapur"


NavigateUrl="https://www.fsb.org.in/"></asp:HyperLink>

</td></tr>

<tr>

<td class="auto-style3">

<asp:Label ID="calendar" runat="server" Text="Select Date:"></asp:Label>

</td>

<td>

<asp:Calendar ID="Calendar1" runat="server"

OnSelectionChanged="Calendar1_SelectionChanged"></asp:Calendar>
</td>

</tr>

</table>

</div>

<p>

<asp:CheckBox runat="server" ID="CheckBox1" Text="I agree to the


terms"></asp:CheckBox><br/>

<asp:Button ID="Button2" runat="server" Text="Submit" OnClick="Button1_Click"


style="width: 61px" />

<asp:Label runat="server" ID="ShowDate" ></asp:Label>

</p>

</form>

<asp:Label ID="userInput" runat="server"></asp:Label>

<asp:Label ID="button" runat="server"></asp:Label>

<asp:Label runat="server" id="genderId"></asp:Label>

</body>

</html>

FormControls.aspx.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

namespace FormControls

public partial class FormControls : System.Web.UI.Page


{

protected void Page_Load(object sender, EventArgs e)

protected void SubmitButton_Click(object sender, EventArgs e)

userInput.Text = UserName.Text;

protected void Button1_Click(object sender, EventArgs e)

button.Text = "You Clicked the Button.";

genderId.Text = "";

if (RadioButton3.Checked)

genderId.Text = "Your gender is " + RadioButton3.Text;

else genderId.Text = "Your gender is " + RadioButton4.Text;

public void Calendar1_SelectionChanged(object sender, EventArgs e)

ShowDate.Text = "You Selected: " + Calendar1.SelectedDate.ToString("D");

}
OUTPUT

6. For loops Execution for drop DownList


AIM: Employ for loops in ASP.NET to dynamically populate a DropDownList with data for
improved data selection.
DESCRIPTION:
In this lab session, the focus is on the practical implementation of for loops in ASP.NET to
enhance the functionality of a DropDownList. The aim is to dynamically populate the
DropDownList with data through iterative processes, allowing for efficient and flexible data
selection. Participants will delve into the mechanics of using for loops to iterate over data
sources, gaining hands-on experience in creating a dynamic and responsive user interface.
Through this exercise, students will develop a deeper understanding of how to optimize user
interactions by dynamically updating DropDownList options, a valuable skill in web
application development.
SOUCE CODE
DropdownList.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Dropdownlist.aspx.cs"
Inherits="DropdownListForLoop.Dropdownlist" %>

<!DOCTYPE html>

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

<head runat="server">

<title></title>

</head>

<body>

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

<div>

<label for="cities">Select City:</label>

<asp:DropDownList runat="server" ID="ddlCustomers">

</asp:DropDownList>

</div>

</form>

</body>

</html>

DropdownList.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.Collections;
namespace DropdownListForLoop

public partial class Dropdownlist : System.Web.UI.Page

protected void Page_Load(object sender, EventArgs e)

if (!this.IsPostBack)

ArrayList cities = new ArrayList();

cities.Add("Hyderabad");

cities.Add("Delhi");

cities.Add("Mumbai");

cities.Add("Bangalore");

//Add blank item at index 0.

ddlCustomers.Items.Insert(0, new ListItem("", ""));

//Loop and add items from ArrayList.

foreach (object city in cities)

ddlCustomers.Items.Add(new ListItem(city.ToString(), city.ToString()));

}
OUTPUT

7. ADO.Net connectivity for Accesing MSSQL Table for select andCreate


AIM: Establish ADO.NET connectivity in ASP.NET to enable seamless retrieval and display of
data from MSSQL tables.
DESCRIPTION:
This lab session is dedicated to mastering ADO.NET connectivity in the context of ASP.NET,
with a focus on accessing MSSQL tables for select and create operations. The aim is to equip
participants with the skills necessary to seamlessly retrieve and display data from MSSQL
tables using ADO.NET. The objective extends to implementing robust mechanisms for
creating new records, thereby enhancing the data manipulation capabilities of ASP.NET
applications. Through hands-on exercises, participants will gain practical insights into
establishing and managing connections, executing queries, and leveraging ADO.NET
functionalities for effective database interactions in the ASP.NET environment. The expected
outcome is a proficient understanding of ADO.NET techniques, enabling participants to
develop data-driven ASP.NET applications with enhanced select and create operations.
SOURCE CODE:

using System;
using System.Collections.Generic;
using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Data.SqlClient;

using System.Xml.Linq;

namespace datasource

internal class Program

static void Main(string[] args)


{

new Program().CreateTable();

new Program().InsertOperation();

new Program().UpdateOperation();

public void CreateTable()

SqlConnection con = null;

try

// Creating Connection

con = new SqlConnection("data source=.; database=fsbdc; integrated


security=SSPI");

// writing sql query

SqlCommand cm = new SqlCommand("create table faculty(id varchar(100) not null,


name varchar(100), email varchar(50), join_date date, salary varchar(100))", con);

// Opening Connection

con.Open();

// Executing the SQL query

cm.ExecuteNonQuery();

// Displaying a message

Console.WriteLine("Table created Successfully");

catch (Exception e)

Console.WriteLine("OOPs, something went wrong." + e);

// Closing the connection


finally

con.Close();

public void InsertOperation()

SqlConnection con1 = null;

try

// Creating Connection

con1 = new SqlConnection("data source=.; database=fsbdc; integrated


security=SSPI");

// writing sql query

SqlCommand cm1 = new SqlCommand("insert into faculty(id, name, email,


join_date,salary)values('1001', 'Teja', '[email protected]', '1/09/2023', '25000')", con1);

SqlCommand cm2 = new SqlCommand("Select * from faculty", con1);

// Opening Connection

con1.Open();

// Executing the SQL query

cm1.ExecuteNonQuery();

cm2.ExecuteNonQuery();

// Displaying a message

Console.WriteLine("Values inserted Successfully");

Console.WriteLine("Table Values after insert opeartion");

SqlDataReader sdr = cm2.ExecuteReader();

while (sdr.Read())

{
Console.WriteLine(sdr["id"] + " " + sdr["name"] + " " + sdr["email"] + " " +
sdr["salary"]); // Displaying Record

catch (Exception e)

Console.WriteLine("OOPs, something went wrong." + e);

// Closing the connection

finally

con1.Close();

public void UpdateOperation()

SqlConnection con1 = null;

try

// Creating Connection

con1 = new SqlConnection("data source=.; database=fsbdc; integrated


security=SSPI");

// writing sql query

SqlCommand cm3 = new SqlCommand("UPDATE faculty SET salary='40000' WHERE


id='1001';", con1);

SqlCommand cm4 = new SqlCommand("Select * from faculty", con1);

// Opening Connection

con1.Open();

// Executing the SQL query


cm3.ExecuteNonQuery();

cm4.ExecuteNonQuery();

// Displaying a message

Console.WriteLine("Values Updated Successfully");

Console.WriteLine("Table values after update operation");

SqlDataReader sdr2 = cm4.ExecuteReader();

while (sdr2.Read())

Console.WriteLine(sdr2["id"] + " " + sdr2["name"] + " " + sdr2["email"] + " " +


sdr2["salary"]); // Displaying Record

catch (Exception e)

Console.WriteLine("OOPs, something went wrong." + e);

// Closing the connection

finally

con1.Close();

OUTPUT:
8. Asp.net for student marks using HTML along with Form Controls
AIM: Design and implement an ASP.NET web form for student marks utilizing HTML and
Form Controls in order to facilitate efficient data entry and submission. The aim is to provide
a practical understanding of creating interactive user interfaces and handling user inputs in
the context of a student marks management system, enhancing skills crucial for web
development in the laboratory setting.

DESCRIPTION:
This lab session is dedicated to the practical exploration of web development using
ASP.NET, HTML, and Form Controls for the creation of a student marks management
system. The aim is to guide participants in designing and implementing an interactive
web form that allows for the seamless entry and submission of student marks.
Through the utilization of HTML and Form Controls in ASP.NET, participants will gain
hands-on experience in creating a user-friendly interface, capturing essential data
such as student names, subjects, and marks. The session aims to foster a deeper
understanding of web form design principles, data input handling, and event-driven
programming in the context of a student-centric application. Participants will be
empowered with skills applicable to real-world web development scenarios,
preparing them for more advanced projects in the ASP.NET environment.

SOURCE CODE:
StudentMarks.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StudentMarks.aspx.cs"
Inherits="StudentMarks.StudentMarks" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2>Student Marks Entry</h2>
<div>
<label for="txtStudentRollNO">Student RollNO:</label>
<asp:TextBox ID="txtStudentRollNO" runat="server" CssClass="form-
control"></asp:TextBox>
</div>
<br/>

<div>
<label for="txtStudentName">Student Name:</label>
<asp:TextBox ID="txtStudentName" runat="server" CssClass="form-
control"></asp:TextBox>
</div>
<br/>
<div>
<label for="txtSubject">Subject:</label>
<asp:DropDownList ID="Subject" runat="server" >
<asp:ListItem Value="">Select</asp:ListItem>
<asp:ListItem>UNIX</asp:ListItem>
<asp:ListItem>ASP.NET</asp:ListItem>
<asp:ListItem>OOAD</asp:ListItem>
<asp:ListItem>SOFTWARE QUALITY TESTING</asp:ListItem>
<asp:ListItem>MOBILE APPLICATIONS</asp:ListItem>
</asp:DropDownList>
<label for="txtMarks">Marks:</label>
<asp:TextBox ID="txtMarks" runat="server" CssClass="form-control"></asp:TextBox>

</div>

<br/>
<br/>
<br/>
<div>
<asp:Button ID="btnSubmit" runat="server" Text="Submit"
OnClick="btnSubmit_Click" CssClass="btn btn-primary" />
</div>
</div>
</form>
</body>
</html>
StudentMarks.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

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

}
protected void btnSubmit_Click(object sender, EventArgs e)
{
// Handle the submit button click event
string studentRollNO = txtStudentRollNO.Text;
string studentName = txtStudentName.Text;
string subject = Subject.SelectedValue;
string marks = txtMarks.Text;

// Perform any additional processing or database operations here

// For demonstration purposes, you can display a message


Response.Write($"Student RolNO: {studentRollNO}, Student: {studentName}, Subject:
{subject}, Marks: {marks}");
}
}
}

OUTPUT:

You might also like