0% found this document useful (0 votes)
19 views72 pages

ASP.NET Practical Tasks Overview

Dot net practical record

Uploaded by

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

ASP.NET Practical Tasks Overview

Dot net practical record

Uploaded by

sheemafirdhouse
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

THIRUVALLUVAR UNIVERSITY

(A State University Accredited with “B+” by NAAC)


Serkaddu, Vellore - 632 511

DEPARTMENT OF
COMPUTER SCIENCE
SEMESTER V - PRACTICALS

DOT NET PROGRAMMING

I I I - I N T E G R A T E D M . S C . D A T A S C I E N C E & B I G D A T A A N A LY T I C S
2025 - 2026

Name

Register Number

Subject Code
THIRUVALLUVAR UNIVERSITY
(A State University Accredited with “B+” by NAAC)
Serkaddu, Vellore - 632 511

DEPARTMENT OF COMPUTER SCIENCE

This is to certify that the work presented herein is an authentic record


of the practical tasks completed by ,
Register No. 30023I050 , of II [Link]. Computer Science, during
the Academic Year 2025 - 2026, as part of the practical requirements for
the course

DOT NET PROGRAMMING

SEMESTER V - PRACTICALS

STAFF-IN-CHARGE HEAD OF THE DEPARTMENT

Submitted for the University Practical Examination held on


at Thiruvalluvar University, Serkkadu, Vellore - 632 115.

EXTERNAL EXAMINER EXTERNAL EXAMINER


CONTENT

EX. PAGE STAFF


DATE TITLE
NO. NO. SIGNATURE

1 24-6-2025 WEB APPLICATIONS AND TOOLS 1

2 02-7-2025 HTML CONTROLS 5

3 10-7-2025 SERVER CONTROLS 9

4 18-7-2025 WEB CONTROLS 13

5 28-7-2025 LIST CONTROLS 17

RICH CONTROL - VALIDATION


6 5-08-2025 21
CONTROLS

7 6-08-2025 DATA CONTROLS 26


DATA BINDING WITH WEB
8 13-8-2025 31
CONTROLS
DATA BINDING WITH DATA
9 22-8-2025 36
CONTROLS

10 25-8-2025 DATABASE OPERATIONS 41


DATABASE OPERATIONS USING
11 02-9-2025 46
DATA CONTROLS

12 03-9-2025 XML CLASSES 52

AUTHENTICATION –
13 12-9-2025 56
AUTHORIZATION

14 19-9-2025 TICKET RESERVATION 61

15 22-9-2025 ONLINE EXAMINATION 66


[Link]
WEB APPLICATIONS AND TOOLS
DATE:24-6-2025

AIM:

To write a [Link] program to create Web Applications using various Tools.

DESCRIPTION :

This program is a basic [Link] Web Forms application that demonstrates how to collect user
input, process it on the server side, and display dynamic output on the web page.

🔹 Components Used

1. TextBox (txtName) – Allows the user to enter their name.

2. Button (btnSubmit) – Submits the input and triggers an event on the server.

3. Label (lblMessage) – Displays the output message (a greeting or validation message).

🔹 Working of the Program

1. When the page loads, it shows a textbox, a button, and an empty label.

2. The user types their name into the textbox.

3. On clicking the "Say Hello" button, the event handler btnSubmit_Click in the code-behind file
([Link]) executes.

4. The program checks:

o If the textbox contains a value → it displays “Hello, {Name}!” in the label.

o If the textbox is empty → it displays “Please enter your name.”

5. The message is shown on the same page without reloading it from scratch, thanks to [Link]’s
server-side event handling.

1
PROGRAM:

[Link]

<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true"


CodeBehind="[Link]" Inherits="ex1._Default" %>

<!DOCTYPE html>
<html>
<head runat="server">
<title>[Link] Hello Program</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2>Enter Your Name</h2>
<asp:TextBox ID="txtName" runat="server" />
<asp:Button ID="btnSubmit" runat="server" Text="Say Hello"
OnClick="btnSubmit_Click" />
<br /><br />
<asp:Label ID="lblMessage" runat="server" ForeColor="Blue"
Font-Size="Large"></asp:Label>
</div>
</form>
</body>
</html>

[Link]

using System;

namespace ex1
{
public partial class _Default : Page
{
protected void Page_Load(object sender, EventArgs e)
{

2
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
string name = [Link]();
if (![Link](name))
{
[Link] = "Hello, " + name + "!";
}
else
{
[Link] = "Please enter your name.";
}
}

}
}

3
OUTPUT:

RESULT:
Thus, the above Web Application and Tools [Link] program executed successfully.

4
[Link]
HTML CONTROLS
DATE:02-07-2025

AIM:

To write a [Link] program to use HTML Controls.

DESCRIPTION:

This [Link] Web Forms application demonstrates the use of HTML Server Controls (TextBox,
RadioButton, Button, and Label) to capture and display user input dynamically.

 The page ([Link]) contains the following controls:

o A TextBox (txtName) for entering the user's name.

o A TextBox (txtEmail) for entering the user's email address.

o Two RadioButton controls (rdoMale and rdoFemale) grouped under the same
GroupName to select gender.

o A Button (btnSubmit) that triggers an event when clicked.

o A Label (lblOutput) used to display the processed output.

 In the code-behind file ([Link]), the btnSubmit_Click event handler retrieves the
values entered by the user:

o The name from txtName.

o The email from txtEmail.

o The selected gender based on which radio button is checked.

 After submission, the program dynamically generates a formatted message and displays it
in the lblOutput label.

5
PROGRAM:

[Link]

<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true"


CodeBehind="[Link]" Inherits="WebApplication2._Default" %>
<!DOCTYPE hmtl>
<html>
<head runat="server">
<title>[Link] HTML Controls Example</title>
</head>
<body>
<form id="form1" runat="server">
<h2>HTML Controls in [Link]</h2>

<!-- HTML Controls -->


<asp:TextBox ID="txtName" runat="server" Text="Enter your Name" /><br /><br />
<asp:TextBox ID="txtEmail" runat="server" Text="Enter your Email"/><br /><br />

Gender
<asp:RadioButton ID="rdoMale" runat="server" Text="Male" GroupName="myop"/>
<asp:RadioButton ID="rdoFemale" runat="server" Text="FeMale"
GroupName="myop"/>
<br /><br />

<asp:Button ID= "btnSubmit" runat="server" Text="Submit"


OnClick="btnSubmit_Click" />

<hr />
<h3>Output:</h3>
<asp:Label ID="lblOutput" runat="server" ></asp:Label>
</form>
</body>
</html>

[Link]

using System;

namespace WebApplication2

6
{
public partial class _Default : [Link]
{
protected void Page_Load(object sender, EventArgs e) { }
public void btnSubmit_Click(object sender, EventArgs e)
{
string name = [Link];
string email = [Link];
string gender = [Link] ? "Male" : ([Link] ? "Female" : "Not
Selected");

[Link] = $"Hello <b>{name}</b>!<br/>" +


$"Your Email: {email}<br/>" +
$"Gender: {gender}";
}
}
}

7
OUTPUT:

RESULT:
Thus, the above [Link] program using HTML Controls executed successfully.
8
[Link]
SERVER CONTROLS
DATE:10-07-2025

AIM:

To write a [Link] program to create Web Applications which contains Server Controls.

DESCRIPTION :

This [Link] Web Forms application is designed to check whether a person is eligible
to vote based on their age. It uses server controls for input and output, along with C# code-
behind logic for processing.

 The web page ([Link]) contains:


 A TextBox (txtName) to enter the user’s name.
 A TextBox (txtAge) to enter the user’s age.
 A Button (btnCheck) to check voting eligibility.
 A Label (lblResult) to display the result.
 When the Check Eligibility button is clicked, the event handler btnCheck_Click in
[Link] executes.
 The program logic is as follows:
 It first checks if the entered age is numeric using [Link]().
 If valid:
1. If the age is 18 or above, the program displays a message saying the
user is eligible to vote.
2. If the age is below 18, it shows a message saying the user is not
eligible.

If the input is invalid (not numeric), it prompts the user to enter a valid age.

9
PROGRAM:

[Link]

<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true"


CodeBehind="[Link]" Inherits="WebApplication3._Default" %>
<html>
<head runat="server">
<title>Voter Age Eligibility</title>
</head>
<body>
<form id="form1" runat="server">
<h2>Voter Age Eligibility Checker</h2>

<!-- Server Controls -->


<asp:Label ID="lblName" runat="server" Text="Enter Your Name:" />
<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
<br /><br />

<asp:Label ID="lblAge" runat="server" Text="Enter Your Age:" />


<asp:TextBox ID="txtAge" runat="server"></asp:TextBox>
<br /><br />

<asp:Button ID="btnCheck" runat="server" Text="Check Eligibility"


OnClick="btnCheck_Click" />
<hr />

<h3>Result:</h3>
<asp:Label ID="lblResult" runat="server" Text=""></asp:Label>
</form>
</body>
</html>

[Link]

using System;
namespace WebApplication3
{
public partial class _Default : Page
{
10
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnCheck_Click(object sender, EventArgs e)
{
string name = [Link];
int age;

if ([Link]([Link], out age))


{
if (age >= 18)
{
[Link] = $"Hello <b>{name}</b>! You are <b>eligible</b> to vote.";
}
else
{
[Link] = $"Hello <b>{name}</b>! You are <b>not eligible</b> to
vote. Minimum age is 18.";
}
}
else
{
[Link] = " Please enter a valid numeric age.";
}
}
}
}

11
OUTPUT:

RESULT:
Thus, the above Server Controls [Link] program executed successfully.
12
[Link]
WEB CONTROLS
DATE:18-07-2025

AIM:

To write a [Link] program to use Web Controls.

DESCRIPTION:

This [Link] Web Forms application checks whether a given number is prime or not
using web controls and C# code-behind.
Working of the Program:
1. The webpage ([Link]) provides:
o A TextBox (txtNumber) for entering an integer.
o A Button (btnCheck) to trigger the prime number check.
o A Label (lblResult) to display the result dynamically.
2. When the user clicks the Check Prime button, the event handler btnCheck_Click in
[Link] is executed.
3. The logic works as follows:
o The input is validated using [Link]() to ensure it is an integer.
o If the number is less than or equal to 1, it is immediately declared not prime.
o Otherwise, the program checks divisibility from 2 up to the square root of the
number ([Link](num)).
o If the number is divisible by any of these values, it is marked not prime; otherwise,
it is a prime number.

13
PROGRAM:

[Link]

<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true"


CodeBehind="[Link]" Inherits="ex4._Default" %>

<html>
<head runat="server">
<title>Prime Number Verification</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2>Prime Number Verification using Web Controls</h2>

<asp:Label ID="lblNumber" runat="server" Text="Enter a number: "></asp:Label>


<asp:TextBox ID="txtNumber" runat="server"></asp:TextBox>
<br /><br />

<asp:Button ID="btnCheck" runat="server" Text="Check Prime"


OnClick="btnCheck_Click" />
<br /><br />

<asp:Label ID="lblResult" runat="server" ForeColor="Blue"></asp:Label>


</div>
</form>
</body>
</html>

[Link]

using System;

namespace ex4
{
public partial class _Default : Page
{
protected void Page_Load(object sender, EventArgs e)

14
{
}
protected void btnCheck_Click(object sender, EventArgs e)
{
int num;
if ([Link]([Link], out num))
{
if (num <= 1)
{
[Link] = num + " is NOT a prime number.";
return;
}

bool isPrime = true;


for (int i = 2; i <= [Link](num); i++)
{
if (num % i == 0)
{
isPrime = false;
break;
}
}

if (isPrime)
[Link] = num + " is a PRIME number.";
else
[Link] = num + " is NOT a prime number.";
}
else
{
[Link] = "Please enter a valid integer.";
}
}
}
}

15
OUTPUT:

RESULT:
Thus, the above [Link] program using Web Controls executed successfully.

16
[Link]
LIST CONTROLS
DATE:28-07-2025

AIM:

To write a [Link] program for creating Web application Using List Controls.

DESCRIPTION:

This [Link] Web Forms application demonstrates how to use the DropDownList control for
country selection with server-side event handling.

 The page ([Link]) contains a DropDownList (ddlCountry) that displays a list of


countries including India, USA, UK, Australia, and Canada. An initial placeholder option (--
Select Country --) is provided.

 The AutoPostBack property is enabled, which means that when the user changes the
selected item, the page posts back to the server automatically.

 The SelectedIndexChanged event (ddlCountry_SelectedIndexChanged) is used to handle


user selection.
 A Label (lblMessage) is used to display messages to the user based on their selection.

1. When the page first loads (Page_Load), if it is not a postback, the label displays the
instruction:
“Please select your country.”
2. When the user selects a country from the DropDownList:

o If a valid country is chosen, the label displays:


“You selected: [CountryName]”

o If the placeholder option is selected, it reminds the user:


“Please select a valid country.”

17
PROGRAM:

[Link]

<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true"


CodeBehind="[Link]" Inherits="list._Default" %>

<!DOCTYPE html>
<html>
<head runat="server">
<title>Country Selection using DropDownList</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2>Select Your Country</h2>
<asp:DropDownList ID="ddlCountry" runat="server" AutoPostBack="true"
OnSelectedIndexChanged="ddlCountry_SelectedIndexChanged">
<asp:ListItem Text="-- Select Country --" Value="" />
<asp:ListItem Text="India" Value="India" />
<asp:ListItem Text="USA" Value="USA" />
<asp:ListItem Text="UK" Value="UK" />
<asp:ListItem Text="Australia" Value="Australia" />
<asp:ListItem Text="Canada" Value="Canada" />
</asp:DropDownList>
<br /><br />
<asp:Label ID="lblMessage" runat="server" Font-Bold="true"
ForeColor="Green"></asp:Label>
</div>
</form>
</body>
</html>

18
[Link]

using System;
namespace list
{
public partial class _Default : Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
[Link] = "Please select your country.";
}
}
protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)
{
if (![Link]([Link]))
{
[Link] = "You selected: " + [Link];
}
else
{
[Link] = "Please select a valid country.";
}
}
}
}

19
OUTPUT:

RESULT:
Thus, the above Web Application using List Controls in [Link] executed successfully.

20
[Link]
RICH CONTROL - VALIDATION CONTROLS
DATE:05-08-2025

AIM:

To create an [Link] web page design using Rich Control, validate user input using Validation
controls. working with File concepts.

DESCRIPTION:

This [Link] Web Forms application demonstrates the use of Rich Controls, Validation
Controls, and basic File Handling concepts.

1. User Registration Form

o The web page allows the user to enter their Name, Email ID, select Date of Birth
using a Calendar control, and upload a file using the FileUpload control.

2. Validation Controls

o A RequiredFieldValidator ensures that the Name and File fields are not left empty.

o A RegularExpressionValidator validates that the Email ID entered is in the correct


format (e.g., example@[Link]).

3. Rich Controls

o Calendar Control is used to select the user’s Date of Birth.

o FileUpload Control is used to upload a file from the user’s computer.

4. File Handling Concepts

o The uploaded file is saved into the server-side folder ~/Uploads/.

o User details (Name, Email, DOB) are stored in a text file named [Link] on the
server.

o Each new submission appends user data to the file, preserving previous entries.

5. Output

o Upon successful submission, a confirmation message "Data saved successfully!" is


displayed.

21
PROGRAM:

[Link]

<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true"


CodeBehind="[Link]" Inherits="richcontrl._Default" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title>[Link] Rich Control Example</title>
</head>
<body>
<form id="form1" runat="server">
<div style="width:600px; margin:auto; padding:20px; border:1px solid #333;">
<h2>User Registration Form</h2>

<asp:Label ID="lblName" runat="server" Text="Enter Name: "></asp:Label>


<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvName" runat="server"
ControlToValidate="txtName"
ErrorMessage="* Name is required"
ForeColor="Red"></asp:RequiredFieldValidator>
<br /><br />

<asp:Label ID="lblEmail" runat="server" Text="Enter Email: "></asp:Label>


<asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="revEmail" runat="server"
ControlToValidate="txtEmail"
ErrorMessage="* Enter a valid Email"
ForeColor="Red"
ValidationExpression="\w+@\w+\.\w+"></asp:RegularExpressionValidator>
<br /><br />

<asp:Label ID="lblDOB" runat="server" Text="Select Date of Birth:


"></asp:Label>
<asp:Calendar ID="calDOB" runat="server"></asp:Calendar>
<br />

<asp:Label ID="lblFile" runat="server" Text="Upload File: "></asp:Label>


<asp:FileUpload ID="fileUpload" runat="server" />
<asp:RequiredFieldValidator ID="rfvFile" runat="server"
ControlToValidate="fileUpload"
22
InitialValue=""
ErrorMessage="* Please upload a file"
ForeColor="Red"></asp:RequiredFieldValidator>
<br /><br />

<asp:Button ID="btnSubmit" runat="server" Text="Submit"


OnClick="btnSubmit_Click" />
<br /><br />

<asp:Label ID="lblMessage" runat="server" ForeColor="Green"></asp:Label>


</div>
</form>
</body>
</html>

[Link]
using System;

namespace richcontrl
{
public partial class _Default : Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
if ([Link])
{
string name = [Link];
string email = [Link];
string dob = [Link]();
// Save uploaded file
if ([Link])
{
string savePath = [Link]("~/Uploads/");
if (![Link](savePath))
{
[Link](savePath);
}
string filePath = savePath + [Link]([Link]);

23
[Link](filePath);
}

// Write user data into a text file


string dataPath = [Link]("~/[Link]");
using (StreamWriter sw = new StreamWriter(dataPath, true))
{
[Link]("Name: " + name);
[Link]("Email: " + email);
[Link]("DOB: " + dob);
[Link]("-------------------------");
}
[Link] = "Data saved successfully!";
}
}
}
}

24
OUTPUT:

RESULT:
Thus, the above [Link] program using Rich Controls executed successfully.

25
[Link]
DATA CONTROLS
DATE:06-08-2025

AIM:

To write a [Link] program to create Web Applications with Data Controls.

DESCRIPTION :

This [Link] Web Forms application demonstrates Data Controls (DropDownList and
GridView) for state selection in India.

 A DropDownList control displays a list of states (Tamil Nadu, Kerala, Karnataka,


Maharashtra, West Bengal).

 When a state is selected, the corresponding capital city and official language are fetched
from a dictionary in the code-behind.

 The selected state details are displayed in a GridView.

1. Page loads with states in the dropdown.

2. User selects a state from the DropDownList.

3. The selection triggers the ddlStates_SelectedIndexChanged event.

4. The details of the selected state (State, Capital, Language) are displayed in the GridView.

26
PROGRAM:

[Link]

<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true"


CodeBehind="[Link]" Inherits="StateSelection._Default" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title>[Link] Data Controls Example - State Selection</title>
</head>
<body>
<form id="form1" runat="server">
<h2>Select State in India</h2>

<!-- DropDownList for States -->


<asp:DropDownList ID="ddlStates" runat="server" AutoPostBack="true"
OnSelectedIndexChanged="ddlStates_SelectedIndexChanged">
</asp:DropDownList>

<br /><br />

<!-- GridView to show details -->


<asp:GridView ID="gvStateInfo" runat="server" AutoGenerateColumns="false"
BorderColor="Black" BorderWidth="1px">
<Columns>
<asp:BoundField DataField="State" HeaderText="State" />
<asp:BoundField DataField="Capital" HeaderText="Capital" />
<asp:BoundField DataField="Language" HeaderText="Language" />
</Columns>
</asp:GridView>

</form>
</body>
</html>

27
[Link]
using System;

namespace StateSelection
{
public partial class _Default : [Link]
{
// Sample State Data
private Dictionary<string, (string Capital, string Language)> states = new
Dictionary<string, (string, string)>()
{
{"Tamil Nadu", ("Chennai", "Tamil")},
{"Kerala", ("Thiruvananthapuram", "Malayalam")},
{"Karnataka", ("Bengaluru", "Kannada")},
{"Maharashtra", ("Mumbai", "Marathi")},
{"West Bengal", ("Kolkata", "Bengali")}
};

protected void Page_Load(object sender, EventArgs e)


{
if (!IsPostBack)
{
[Link]("Select State");
foreach (var state in [Link])
{
[Link](state);
}
}
}

protected void ddlStates_SelectedIndexChanged(object sender, EventArgs e)


{
string selectedState = [Link];

if ([Link](selectedState))
{
var details = new List<dynamic>
{
new { State = selectedState, Capital = states[selectedState].Capital, Language =
states[selectedState].Language }

28
};

[Link] = details;
[Link]();
}
else
{
[Link] = null;
[Link]();
}
}
}
}

29
OUTPUT:

RESULT:
Thus, the above [Link] program using Data Controls executed successfully.

30
[Link]
DATA BINDING WITH WEB CONTROLS
DATE:13-08-2025

AIM:

To Create a [Link] program for Data Binding with Web Controls.

DESCRIPTION:

This [Link] Web Forms application demonstrates the concept of Data Binding with Web
Controls using a DropDownList and a GridView.

 The page ([Link]) contains a DropDownList control (ddlCountries) which is bound


to an array of country names (India, USA, UK, Australia, Canada). The DataSource
property is used to assign the array, and the DataBind() method is called to bind the data to
the control.

 When a user selects a country from the DropDownList, the SelectedIndexChanged event is
triggered, and the selected value is displayed in a Label control (lblMessage).

 The program also demonstrates binding tabular data to a GridView control (GridView1). A
DataTable is created at runtime containing student details like Roll No, Name, and Course.
This DataTable is assigned as the data source to the GridView and displayed in a tabular
format.

 The IsPostBack property ensures that the data binding occurs only during the first page load,
preventing the controls from being re-bound on every postback.

31
PROGRAM:

[Link]

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="[Link]"

Inherits="_Default" %>

<!DOCTYPE html>
<html>
<head runat="server">
<title>[Link] Data Binding Example</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2>Data Binding with Web Controls</h2>

<asp:Label ID="Label1" runat="server" Text="Select a Country:"></asp:Label>


<br />
<asp:DropDownList ID="ddlCountries" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="ddlCountries_SelectedIndexChanged">
</asp:DropDownList>

<br /><br />

<asp:Label ID="lblMessage" runat="server" Font-Bold="true"></asp:Label>


<br /><br />

<h3>Student Details</h3>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="true"
BorderColor="Black" BorderWidth="1px" CellPadding="5">
</asp:GridView>
</div>
</form>
</body>
</html>

32
[Link]

using System;

public partial class _Default : [Link]

protected void Page_Load(object sender, EventArgs e)

if (!IsPostBack)

// Binding DropDownList

string[] countries = { "India", "USA", "UK", "Australia", "Canada" };

[Link] = countries;

[Link]();

// Binding GridView with sample DataTable

DataTable dt = new DataTable();

[Link]("Roll No");

[Link]("Name");

[Link]("Course");

[Link]("101", "Arun", "C#");

[Link]("102", "Meena", "[Link]");

[Link]("103", "Ravi", "SQL");

[Link]("104", "Divya", "Java");

[Link] = dt;

[Link]();

33
}

protected void ddlCountries_SelectedIndexChanged(object sender, EventArgs e)

[Link] = "You selected: " + [Link];

34
OUTPUT:

RESULT:
Thus, the above [Link] program for Data Binding with Web controls executed successfully.
35
[Link]
DATA BINDING WITH DATA CONTROLS
DATE:22-08-2025

AIM:

To Create a [Link] program for Data Binding with Web Controls.

DESCRIPTION:

This [Link] Web Forms application demonstrates the concept of data binding with data
controls through a College Course Selection system. The application allows students to select a
department and choose one or more courses offered under that department.

1. A DropDownList control (ddlDepartment) is bound to a collection of departments such as


Computer Science, Electronics, Mechanical, and Civil.

2. When the user selects a department, the ListBox control (lstCourses) is populated
dynamically with the courses available in that department using data binding.
3. The student can select multiple courses from the list and submit the selection.

4. The chosen department and corresponding courses are displayed in a GridView control
(gvSelectedCourses) for better tabular representation.

5. Data is managed internally using a Dictionary (key-value collection) and a DataTable for
storing and displaying selected values.

36
PROGRAM:

[Link]

<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true"


CodeBehind="[Link]" Inherits="datacontl._Default" %>

<!DOCTYPE html>
<html>
<head runat="server">
<title>College Course Selection</title>

</head>
<body>
<form id="form1" runat="server">
<div class="container">
<h2>College Course Selection</h2>

<asp:Label ID="lblDept" runat="server" Text="Select Department: "></asp:Label>


<asp:DropDownList ID="ddlDepartment" runat="server" AutoPostBack="True"

OnSelectedIndexChanged="ddlDepartment_SelectedIndexChanged"></asp:DropDownList
>
<br /><br />

<asp:Label ID="lblCourse" runat="server" Text="Available Courses:"></asp:Label>


<br />
<asp:ListBox ID="lstCourses" runat="server"
SelectionMode="Multiple"></asp:ListBox>
<br /><br />

<asp:Button ID="btnSubmit" runat="server" Text="Submit Selection"


CssClass="btn"
OnClick="btnSubmit_Click" />
<br /><br />

<asp:GridView ID="gvSelectedCourses" runat="server"


AutoGenerateColumns="true"
BorderColor="#cccccc" BorderWidth="1px" CellPadding="5"></asp:GridView>
</div>
</form>
</body>
37
</html>

[Link]

using System;

namespace datacontl
{
public partial class _Default : Page
{
Dictionary<string, List<string>> courseData = new Dictionary<string, List<string>>()
{
{ "Computer Science", new List<string>{ "AI", "DATA SCIENCE", "MACHINE LEARNING", "BIG
DATA" } },
{ "Commerce", new List<string>{ "General", "Finance", "Computer Application", "Corporate" }
},

};

protected void Page_Load(object sender, EventArgs e)


{
if (!IsPostBack)
{
[Link] = [Link];
[Link]();
}

}
protected void ddlDepartment_SelectedIndexChanged(object sender, EventArgs e)
{
string dept = [Link];
[Link] = courseData[dept];
[Link]();
}

protected void btnSubmit_Click(object sender, EventArgs e)


{
DataTable dt = new DataTable();
[Link]("Department");
[Link]("Course");

string dept = [Link];

38
foreach (var item in [Link]())
{
DataRow row = [Link]();
row["Department"] = dept;
row["Course"] = [Link][item].Text;
[Link](row);
}

[Link] = dt;
[Link]();

}
}
}

39
OUTPUT:

RESULT:
Thus, the above [Link] program for Data Binding with Data controls executed successfully.

40
[Link]
DATABASE OPERATIONS
DATE:25-08-2025

AIM:

To Create a [Link] program to perform Database Operations Insert, Update and Delete.

DESCRIPTION:
This [Link] Web Forms application demonstrates basic database operations (CRUD)—
Create, Read, Update, Delete—on a students table using standard [Link] controls
(TextBoxes, Labels, Buttons).

 User Interface:
 The page ([Link]) contains TextBox controls to input:
o Student ID, Name, Age, Course
 Buttons to perform operations:
o Insert: Add a new student record.
o Update: Modify an existing student record by StudentID.
o Delete: Remove a student record by StudentID.
 A Label (lblMessage) displays success or error messages to the user.
 Backend Logic ([Link]):
 Uses [Link] with SqlConnection and SqlCommand to interact with SQL Server.
 Connection string includes:
o Encrypt=True and TrustServerCertificate=True to avoid SSL certificate issues.
o Integrated Security for Windows Authentication.
 Insert Operation: Adds a new student with name, age, and course.
 Update Operation: Updates existing student details based on StudentID. Shows a message
if the ID is not found.
 Delete Operation: Deletes a student record by StudentID. Shows a message if the ID does
not exist.
 Input Clearing: After every operation, all TextBox fields are cleared using a ClearFields()
method.

41
PROGRAM:

[Link]

<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true"


CodeBehind="[Link]" Inherits="StudentBasic._Default" %>

<!DOCTYPE html>
<html>
<head runat="server">
<title>Basic CRUD without Data Controls</title>
</head>
<body>
<form id="form1" runat="server">
<div style="font-family:Arial; padding:20px;">
<h2>Student Management (Basic Controls)</h2>

<asp:Label ID="lblID" runat="server" Text="Student ID: "></asp:Label>


<asp:TextBox ID="txtID" runat="server"></asp:TextBox>
<br /><br />

<asp:Label ID="lblName" runat="server" Text="Name: "></asp:Label>


<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
<br /><br />

<asp:Label ID="lblAge" runat="server" Text="Age: "></asp:Label>


<asp:TextBox ID="txtAge" runat="server"></asp:TextBox>
<br /><br />

<asp:Label ID="lblCourse" runat="server" Text="Course: "></asp:Label>


<asp:TextBox ID="txtCourse" runat="server"></asp:TextBox>
<br /><br />

<asp:Button ID="btnInsert" runat="server" Text="Insert"


OnClick="btnInsert_Click" />
<asp:Button ID="btnUpdate" runat="server" Text="Update"
OnClick="btnUpdate_Click" />
<asp:Button ID="btnDelete" runat="server" Text="Delete"
OnClick="btnDelete_Click" />
<br /><br />

<asp:Label ID="lblMessage" runat="server" ForeColor="Blue"></asp:Label>


</div>
42
</form>
</body>
</html>

[Link]
using System;
using [Link];

namespace StudentBasic
{
public partial class _Default : Page
{
protected void Page_Load(object sender, EventArgs e)
{
[Link] = "";
}
string conStr = "Data Source=localhost\\SQLEXPRESS;Initial Catalog=forum;Integrated
Security=True;Encrypt=True;TrustServerCertificate=True;";
// Insert new student
protected void btnInsert_Click(object sender, EventArgs e)
{
using (SqlConnection con = new SqlConnection(conStr))
{
string query = "INSERT INTO students (Name, Age, Course) VALUES (@Name, @Age,
@Course)";
SqlCommand cmd = new SqlCommand(query, con);
[Link]("@Name", [Link]);
[Link]("@Age", Convert.ToInt32([Link]));
[Link]("@Course", [Link]);
[Link]();
[Link]();
[Link]();
[Link] = "Record inserted successfully!";
}
ClearFields();
}

// Update existing student


protected void btnUpdate_Click(object sender, EventArgs e)
{
using (SqlConnection con = new SqlConnection(conStr))
{

43
string query = "UPDATE students SET Name=@Name, Age=@Age, Course=@Course
WHERE StudentID=@ID";
SqlCommand cmd = new SqlCommand(query, con);
[Link]("@ID", Convert.ToInt32([Link]));
[Link]("@Name", [Link]);
[Link]("@Age", Convert.ToInt32([Link]));
[Link]("@Course", [Link]);
[Link]();
int rows = [Link]();
[Link]();
if (rows > 0)
[Link] = "Record updated successfully!";
else
[Link] = "Student ID not found!";
}
ClearFields();
}
// Delete student
protected void btnDelete_Click(object sender, EventArgs e)
{
using (SqlConnection con = new SqlConnection(conStr))
{
string query = "DELETE FROM students WHERE StudentID=@ID";
SqlCommand cmd = new SqlCommand(query, con);
[Link]("@ID", Convert.ToInt32([Link]));
[Link]();
int rows = [Link]();
[Link]();
if (rows > 0)
[Link] = "Record deleted successfully!";
else
[Link] = "Student ID not found!";
}
ClearFields();
}

// Clear input fields


private void ClearFields()
{
[Link] = [Link] = [Link] = [Link] = "";
}
}
}

44
OUTPUT:

RESULT:
Thus, the above [Link] program for Database Manipulation executed successfully.

45
[Link]
DATABASE OPERATIONS USING DATA
CONTROLS
DATE:02-09-2025

AIM:

To Create a [Link] program to perform Database Operations using Data Controls.

DESCRIPTION:
To create a simple web application for managing employee records (Name and Salary) using
[Link] GridView and data controls, supporting CRUD operations (Create, Read, Update,
Delete) with database interaction.

 Add Employee – Users can enter the employee's name and salary and insert it into the
database using the Insert Employee button.
 Display Employees – The GridView control displays all records from the Employees
table with proper formatting for currency.
 Edit Employee – Inline editing is supported in the GridView. Users can modify name
and salary, then update the database.
 Delete Employee – Users can delete an employee record directly from the GridView.
 Paging – GridView supports paging with 5 records per page for better navigation.

Database Details:
 Database Name: forum
 Table: Employees
 Columns:
o EmployeeID (Primary Key, int, identity)
o Name (nvarchar)
o Salary (decimal)

46
PROGRAM:

[Link]

<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true"


CodeBehind="[Link]" Inherits="Employee._Default" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Simple Employee Management</title>
</head>
<body>
<form id="form1" runat="server">
<div style="font-family:Arial; padding:20px;">
<h2>Employee Management (Name & Salary)</h2>

<asp:Label ID="lblName" runat="server" Text="Name: "></asp:Label>


<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
<br /><br />

<asp:Label ID="lblSalary" runat="server" Text="Salary: "></asp:Label>


<asp:TextBox ID="txtSalary" runat="server"></asp:TextBox>
<br /><br />
<asp:Button ID="btnInsert" runat="server" Text="Insert Employee"
OnClick="btnInsert_Click" />
<br /><br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="EmployeeID"
OnRowEditing="GridView1_RowEditing"
OnRowUpdating="GridView1_RowUpdating"
OnRowCancelingEdit="GridView1_RowCancelingEdit"
OnRowDeleting="GridView1_RowDeleting"
AllowPaging="True"
PageSize="5"
OnPageIndexChanging="GridView1_PageIndexChanging"
BorderColor="Black" BorderWidth="1" CellPadding="5">

<Columns>
<asp:BoundField DataField="EmployeeID" HeaderText="ID"
ReadOnly="true" />
<asp:BoundField DataField="Name" HeaderText="Name" />
<asp:BoundField DataField="Salary" HeaderText="Salary"
DataFormatString="{0:C}" />
47
<asp:CommandField ShowEditButton="true" ShowDeleteButton="true" />
</Columns>
</asp:GridView>
</div>
</form>
</body>
</html>

[Link]
using System;
using [Link];
using [Link];
namespace Employee
{
public partial class _Default : Page
{
string conStr = "Data Source=localhost\\SQLEXPRESS;Initial Catalog=forum;Integrated
Security=True;Encrypt=True;TrustServerCertificate=True;";
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
BindGrid();
}
private void BindGrid()
{
using (SqlConnection con = new SqlConnection(conStr))
{
SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM Employees", con);
DataTable dt = new DataTable();
[Link](dt);
[Link] = dt;
[Link]();
}
}
protected void btnInsert_Click(object sender, EventArgs e)
{
using (SqlConnection con = new SqlConnection(conStr))
{
string query = "INSERT INTO Employees (Name, Salary) VALUES (@Name, @Salary)";
SqlCommand cmd = new SqlCommand(query, con);
[Link]("@Name", [Link]);
[Link]("@Salary", [Link]([Link]));

48
[Link]();
[Link]();
[Link]();
}

[Link] = [Link] = "";


BindGrid();
}

// Edit
protected void GridView1_RowEditing(object sender,
[Link] e)
{
[Link] = [Link];
BindGrid();
}

// Cancel Edit
protected void GridView1_RowCancelingEdit(object sender,
[Link] e)
{
[Link] = -1;
BindGrid();
}

// Update
protected void GridView1_RowUpdating(object sender,
[Link] e)
{
int id = Convert.ToInt32([Link][[Link]].Value);
string name =
(([Link])[Link][[Link]].Cells[1].Controls[0]).Text;
string salary =
(([Link])[Link][[Link]].Cells[2].Controls[0]).Text;

using (SqlConnection con = new SqlConnection(conStr))


{
string query = "UPDATE Employees SET Name=@Name, Salary=@Salary WHERE
EmployeeID=@ID";
SqlCommand cmd = new SqlCommand(query, con);
[Link]("@ID", id);
[Link]("@Name", name);
[Link]("@Salary", [Link](salary));

49
[Link]();
[Link]();
[Link]();
}

[Link] = -1;
BindGrid();
}

// Delete
protected void GridView1_RowDeleting(object sender,
[Link] e)
{
int id = Convert.ToInt32([Link][[Link]].Value);

using (SqlConnection con = new SqlConnection(conStr))


{
string query = "DELETE FROM Employees WHERE EmployeeID=@ID";
SqlCommand cmd = new SqlCommand(query, con);
[Link]("@ID", id);
[Link]();
[Link]();
[Link]();
}

BindGrid();
}

// Paging
protected void GridView1_PageIndexChanging(object sender,
[Link] e)
{
[Link] = [Link];
BindGrid();
}
}
}

50
OUTPUT:

RESULT:
Thus, the above [Link] program for Database Manipulation with Data Control executed
successfully.

51
[Link]
XML CLASSES
DATE:03-09-2025

AIM:

To Create a [Link] program for implementing XML Classes.

DESCRIPTION:

This [Link] Web Forms program demonstrates the use of XML classes in C# for creating and
reading XML files.

 The program uses the XmlDocument class to work with XML data.

o With the XmlElement class, elements such as <Employees> and <Employee> are
created dynamically.

o The AppendChild() method is used to add elements to the document tree.

o The InnerXml property helps assign nested XML content to each <Employee>.

o Finally, the Save() method stores the XML structure in a physical file.

 To read the XML file:

o The Load() method of XmlDocument loads the existing XML file.

o The GetElementsByTagName() method returns a collection (XmlNodeList) of


<Employee> nodes.

o Using XmlNode and its child element access (emp["ID"].InnerText), employee


details are extracted and displayed on the page.

 The Label control shows output messages like the file creation confirmation or the
employee details retrieved from the XML file.

52
PROGRAM:

[Link]

<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true"


CodeBehind="[Link]" Inherits="XmlSimple._Default" %>

<!DOCTYPE html>
<html>
<head runat="server">
<title>Simple XML Demo</title>
</head>
<body>
<form id="form1" runat="server">
<h2>Simple XML Demo</h2>

<asp:Button ID="btnCreate" runat="server" Text="Create XML"


OnClick="btnCreate_Click" />
<br /><br />

<asp:Button ID="btnRead" runat="server" Text="Read XML"


OnClick="btnRead_Click" />
<br /><br />

<asp:Label ID="lblOutput" runat="server" ForeColor="Blue"></asp:Label>


</form>
</body>
</html>

[Link]
using System;
using [Link];
namespace XmlSimple
{
public partial class _Default : [Link]
{
protected void Page_Load(object sender, EventArgs e)
{

}
string xmlPath = @"C:\Users\tvmkr\OneDrive\Desktop\New folder\[Link]"; //
Change path as needed

53
protected void btnCreate_Click(object sender, EventArgs e)
{
XmlDocument doc = new XmlDocument();

// Root element
XmlElement root = [Link]("Employees");
[Link](root);

// Employee 1
XmlElement emp1 = [Link]("Employee");
[Link] = "<ID>1</ID><Name>John</Name>";
[Link](emp1);

// Employee 2
XmlElement emp2 = [Link]("Employee");
[Link] = "<ID>2</ID><Name>Mary</Name>";
[Link](emp2);

[Link](xmlPath);
[Link] = "XML file created at: " + xmlPath;
}

protected void btnRead_Click(object sender, EventArgs e)


{
XmlDocument doc = new XmlDocument();
[Link](xmlPath);

XmlNodeList employees = [Link]("Employee");

string output = "";


foreach (XmlNode emp in employees)
{
output += "ID: " + emp["ID"].InnerText + ", Name: " + emp["Name"].InnerText + "<br />";
}

[Link] = output;
}
}
}

54
OUTPUT:

RESULT:
Thus, the above [Link] program for implementing XML Class executed successfully.

55
[Link]
AUTHENTICATION – AUTHORIZATION
DATE:12-09-2025

AIM:

To Create a [Link] program for Authentication - Authorization.

DESCRIPTION:
This [Link] Web Forms application demonstrates basic authentication and authorization using login
credentials and session management.

 Login Page ([Link]):

o Contains a TextBox for username, a TextBox for password (with


TextMode="Password"), a Login button, and a Label to display error messages.

o When the Login button is clicked, the application validates the entered username and
password.

o If the credentials match (hard-coded as Username = "admin", Password =


"12345"), the user is authenticated and their username is stored in the Session
object.

o The authenticated user is then redirected to a secure page ([Link]).

o If credentials are invalid, an error message is displayed in the label.

 Welcome Page ([Link]):

o On page load, the system checks if the Session["Username"] is set.

o If the session is null (meaning the user has not logged in or has logged out), the user
is redirected back to the Login Page (authentication check).

o If authenticated, a welcome message is shown displaying the username (e.g., Hello,


admin! You are logged in.).

o A Logout button allows the user to end the session. On logout, the session is
cleared, and the user is redirected to the Login Page.

56
PROGRAM:

[Link]

<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true"


CodeBehind="[Link]" Inherits="Login._Default" %>

<!DOCTYPE html>
<html>
<head runat="server">
<title>Login Page</title>
</head>
<body>
<form id="form1" runat="server">
<div style="font-family:Arial; padding:20px;">
<h2>User Login</h2>

<asp:Label ID="lblUser" runat="server" Text="Username: "></asp:Label>


<asp:TextBox ID="txtUsername" runat="server"></asp:TextBox>
<br /><br />

<asp:Label ID="lblPass" runat="server" Text="Password: "></asp:Label>


<asp:TextBox ID="txtPassword" runat="server"
TextMode="Password"></asp:TextBox>
<br /><br />

<asp:Button ID="btnLogin" runat="server" Text="Login"


OnClick="btnLogin_Click" />
<br /><br />

<asp:Label ID="lblMessage" runat="server" ForeColor="Red"></asp:Label>


</div>
</form>
</body>
</html>

57
[Link]

using System;

namespace Login
{
public partial class _Default : [Link]
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnLogin_Click(object sender, EventArgs e)
{
string username = [Link]();
string password = [Link]();

// Hard-coded credentials for simplicity


if (username == "admin" && password == "12345")
{
// Store username in session for authorization
Session["Username"] = username;

// Redirect to secure page


[Link]("~/[Link]");
}
else
{
[Link] = "Invalid username or password!";
}
}
}
}

[Link]

<%@ Page Language="C#" AutoEventWireup="true"


CodeBehind="[Link]" Inherits="[Link]" %>

<!DOCTYPE html>
<html>
<head runat="server">
<title>Welcome Page</title>

58
</head>
<body>
<form id="form1" runat="server">
<div style="font-family:Arial; padding:20px;">
<h2>Welcome Page</h2>

<asp:Label ID="lblWelcome" runat="server" Font-Bold="true"


ForeColor="Green"></asp:Label>
<br /><br />

<asp:Button ID="btnLogout" runat="server" Text="Logout" OnClick="btnLogout_Click"


/>
</div>
</form>
</body>
</html>

[Link]
namespace Login
{
public partial class Welcome : [Link]
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["Username"] == null)
{
// If not authenticated, redirect to login
[Link]("[Link]");
}
else
{
[Link] = "Hello, " + Session["Username"].ToString() + "! You are
logged in.";
}
}
protected void btnLogout_Click(object sender, EventArgs e)
{
// Clear session and redirect to login page
[Link]();
[Link]("[Link]");
}
}
}
59
OUTPUT:

RESULT:
Thus, the above [Link] program for Authentication - Authorization executed successfully.

60
[Link]
TICKET RESERVATION
DATE:19-09-2025

AIM:

To Create a [Link] program for Ticket Reservation.

DESCRIPTION:

This [Link] Web Forms application demonstrates a simple ticket reservation system using
web controls and server-side validation.

 User Input Controls:

o A TextBox (txtName) to enter the passenger’s name.

o Two DropDownList controls (ddlFrom and ddlTo) for selecting the source and
destination cities.

o A TextBox (txtTickets) to specify the number of tickets required.

 Reservation Process:

o When the user clicks the Reserve Ticket button, the program checks whether all
fields are filled properly and if the number of tickets is valid.

o Validation ensures that the source and destination cannot be the same and that the
ticket count is numeric.

o If the details are valid, a confirmation message is displayed showing the


passenger’s name, number of tickets, and journey route.

 Output Display:

o The Label (lblMessage) is used to display either error messages (e.g., missing
fields, invalid input) or the reservation confirmation message.

o After a successful booking, the input fields are cleared for new entries.

61
PROGRAM:

[Link]

<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true"


CodeBehind="[Link]" Inherits="TicketReservation._Default" %>

<!DOCTYPE html>
<html>
<head runat="server">
<title>Ticket Reservation</title>
</head>
<body>
<form id="form1" runat="server">
<div style="font-family:Arial; padding:20px;">
<h2>Ticket Reservation</h2>

<asp:Label ID="lblName" runat="server" Text="Name: "></asp:Label>


<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
<br /><br />

<asp:Label ID="lblFrom" runat="server" Text="From: "></asp:Label>


<asp:DropDownList ID="ddlFrom" runat="server">
<asp:ListItem Text="Select Source" Value="" />
<asp:ListItem Text="City A" Value="City A" />
<asp:ListItem Text="City B" Value="City B" />
<asp:ListItem Text="City C" Value="City C" />
</asp:DropDownList>
<br /><br />

<asp:Label ID="lblTo" runat="server" Text="To: "></asp:Label>


<asp:DropDownList ID="ddlTo" runat="server">
<asp:ListItem Text="Select Destination" Value="" />
<asp:ListItem Text="City X" Value="City X" />
<asp:ListItem Text="City Y" Value="City Y" />
<asp:ListItem Text="City Z" Value="City Z" />
</asp:DropDownList>
<br /><br />

62
<asp:Label ID="lblTickets" runat="server" Text="Number of Tickets:
"></asp:Label>
<asp:TextBox ID="txtTickets" runat="server"></asp:TextBox>
<br /><br />

<asp:Button ID="btnReserve" runat="server" Text="Reserve Ticket"


OnClick="btnReserve_Click" />
<br /><br />

<asp:Label ID="lblMessage" runat="server" ForeColor="Blue"></asp:Label>


</div>
</form>
</body>
</html>

[Link]

using System;

namespace TicketReservation
{
public partial class _Default : [Link]
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnReserve_Click(object sender, EventArgs e)
{
string name = [Link]();
string from = [Link];
string to = [Link];
int tickets = 0;

if ([Link](name) || [Link](from) || [Link](to) ||


![Link]([Link], out tickets))
{
[Link] = "Please fill all fields correctly.";
return;
}

if (from == to)
{

63
[Link] = "Source and destination cannot be the same.";
return;
}

[Link] = $"Hello {name}, your reservation for {tickets} ticket(s) from {from} to {to}
is confirmed!";

// Clear fields after reservation


[Link] = "";
[Link] = 0;
[Link] = 0;
[Link] = "";
}
}
}

64
OUTPUT:

RESULT:
Thus, the above [Link] program for Ticket Reservation executed successfully.

65
[Link]
ONLINE EXAMINATION
DATE:22-09-2025

AIM:

To Create a [Link] program for Online Examination.

DESCRIPTION:

This [Link] Web Forms program demonstrates a simple Computer Science multiple-choice
online examination system using [Link] controls.

 The web page ([Link]) contains:

o Three multiple-choice questions (MCQs) related to Computer Science.

o Each question is implemented using a RadioButtonList control, where the correct


answer is assigned a value of "1" and incorrect answers "0".

o A Submit button (btnSubmit) to evaluate the answers.

o A Label control (lblResult) to display the final score.

 Code-behind ([Link]) logic:

o When the user clicks the Submit Exam button, the program checks the selected
answers of each RadioButtonList.

o For every correct answer, the score is incremented by 1.

o Finally, the total score is displayed on the web page in the result label.

66
PROGRAM:

[Link]

<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true"


CodeBehind="[Link]" Inherits="CSExam._Default" %>

<!DOCTYPE html>
<html>
<head runat="server">
<title>Computer Science Online Exam</title>
</head>
<body>
<form id="form1" runat="server">
<div style="font-family:Arial; padding:20px;">
<h2>Computer Science Online Examination</h2>

<asp:Label ID="lblQ1" runat="server" Text="1. Which data structure works on the


principle of LIFO?"></asp:Label><br />
<asp:RadioButtonList ID="rblQ1" runat="server">
<asp:ListItem Text="Queue" Value="0" />
<asp:ListItem Text="Stack" Value="1" />
<asp:ListItem Text="Linked List" Value="0" />
</asp:RadioButtonList>
<br />

<asp:Label ID="lblQ2" runat="server" Text="2. Which keyword is used to define a


class in C#?"></asp:Label><br />
<asp:RadioButtonList ID="rblQ2" runat="server">
<asp:ListItem Text="function" Value="0" />
<asp:ListItem Text="class" Value="1" />
<asp:ListItem Text="struct" Value="0" />
</asp:RadioButtonList>
<br />

<asp:Label ID="lblQ3" runat="server" Text="3. Which of the following is a


relational database?"></asp:Label><br />
<asp:RadioButtonList ID="rblQ3" runat="server">
<asp:ListItem Text="Oracle" Value="1" />
<asp:ListItem Text="MongoDB" Value="0" />
<asp:ListItem Text="Neo4j" Value="0" />
67
</asp:RadioButtonList>
<br />

<asp:Button ID="btnSubmit" runat="server" Text="Submit Exam"


OnClick="btnSubmit_Click" />
<br /><br />

<asp:Label ID="lblResult" runat="server" ForeColor="Blue"></asp:Label>


</div>
</form>
</body>
</html>

[Link]
using System;

namespace CSExam
{
public partial class _Default : Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnSubmit_Click(object sender, EventArgs e)
{
int score = 0;

// Check Q1
if ([Link] == "1")
score++;

// Check Q2
if ([Link] == "1")
score++;

// Check Q3
if ([Link] == "1")
score++;

[Link] = $"Your score is: {score}/3";


}
}
}
68
OUTPUT:

RESULT:
Thus, the above [Link] program for Data Binding with Data controls executed successfully.

69

You might also like