Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
28 views89 pages

Student Webtech

The document outlines practical programming exercises for students at Arumugham Palaniguru Arts and Science College for Women, focusing on JavaScript, Java Server Pages, and ASP.NET. Each exercise includes an aim, algorithm, program code, and results, covering topics like Fibonacci series, palindrome checking, form validation, and event handling. The document serves as a record of practical work done by students during their semester.

Uploaded by

rooba vathi
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)
28 views89 pages

Student Webtech

The document outlines practical programming exercises for students at Arumugham Palaniguru Arts and Science College for Women, focusing on JavaScript, Java Server Pages, and ASP.NET. Each exercise includes an aim, algorithm, program code, and results, covering topics like Fibonacci series, palindrome checking, form validation, and event handling. The document serves as a record of practical work done by students during their semester.

Uploaded by

rooba vathi
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
You are on page 1/ 89

ARUMUGHAM PALANIGURU ARTS AND

SCIENCE COLLEGE FOR WOMEN

CHATRAPATTI - 626 102

DEPARTMENT OF COMPUTER SCIENCE

Bonafide record work done ____________________________________

______________________ for_______________________________________

in the _____________ Semester during the year ________________ .

Signature of the Staff Signature of the HOD

Submitted to the Practical Examination held on ________________

at Arumugham Palaniguru Arts and Science College for Women.

Internal Examiner External Examiner


CONTENTS

S.NO DATE NAME OF THE PROGRAM PAGE SIGNATURE


NO

JAVASCRIPT

1. Fibonacci Series
2.
Palindrome Checking
3.
Validate Form
4.
Create Popup Window
5. Event Handler
6.
Remove Items from A Dropdown List
7.
Display A Random Image
8. Valid An Email Address.
JAVA SERVER PAGES
9. JSP file using @include directive.
10.
Prime Number Check
11. JSP file using @include directive.
ASP.NET
12.
Page and Forms
13.
Account Registration Form Using Validation
14.
Student Details From Xml File
15.
Vehicle Details In Tree View Control From Xml File
16. Menu Server Control
17.
Student Database Using Sqldatasource Control
18.
Employee Details Using Sitemapdatasource
19.
Personal Database Using Xmldatasource Control
20.
Webpage for Department
21. Send An Mail
JAVA SCRIPT
PROGRAMS
EX.NO:1 FIBONACCI SERIES PAGE NO:
DATE:

AIM:
To Write a JavaScript Program to Generate Fibonacci Series.

ALGORITHM:
1. Start -> Open Visual Studio Code

2. Click File→New File→Enter the File Name with .js extension

3. Enter the Code to generate the Fibonacci Series

4. Open View->Terminal

5. Run the code using node filename.js

6. Save and print the output.

1
PROGRAM:
const prompt=require('prompt-sync')();
const number = prompt('Enter a positive number: ');
let n1 = 0, n2 = 1, nextTerm;
console.log('Fibonacci Series:');
console.log(n1); // print 0
console.log(n2); // print 1
nextTerm = n1 + n2;
while (nextTerm <= number)
{
console.log(nextTerm);
n1 = n2;
n2 = nextTerm;
nextTerm = n1 + n2;
}

2
OUTPUT:

RESULT:
Thus the program is implemented, executed successfully and the output is
verified.

3
EX.NO:2 PALINDROM CHECKING PAGE NO:
DATE:

AIM:
To Write a JavaScript Program For Checking Palindrome Or Not

ALGORITHM:
1. Start -> Open Visual Studio Code

2. Click File→New File→Enter the File Name with .js extension

3. Enter the Code to check palindrome number.

4. Open View->Terminal

5. Run the code using node filename.js

6. Save and print the output.

4
PROGRAM:
function checkPalindrome(string)
{
const len = string.length;
for (let I = 0; I < len / 2; i++)
{
if (string[i] !== string[len – 1 – i])
{
return ‘It is not a palindrome’;
}
}
return ‘It is a palindrome’;
}
const prompt=require(‘prompt-sync’)();
const string = prompt(‘Enter a string: ‘);
const value = checkPalindrome(string);
console.log(value);

5
OUTPUT:

RESULT:
Thus the program is implemented, executed successfully and the output is
verified.

6
EX.NO:3 FORM VALIDATION PAGE NO:
DATE:

AIM:
To Write a JavaScript Program to Validate Form.
ALGORITHM:
1. Start → Open Visual Studio Code

2. Click File New File Enter the File Name with .js extension

3. Enter the Code to check palindrome number.

4. Open View→Terminal

5. Run the code using node filename.js

6. Save and print the output.

7
PROGRAM:
<html>
<head>
<script>
function GEEKFORGEEKS( )
{
var name = document.forms.RegForm.Name.value;
var email = document.forms.RegForm.Email.value;
var phone = document.forms.RegForm.Telephone.value;
var what = document.forms.RegForm.Subject.value;
var password = document.forms.RegForm.Password.value;
var address = document.forms.RegForm.Address.value;
var regEmail=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/g;
var regPhone=/^\d{10}$/;
var regName = /\d+$/g;
if (name == “” || regName.test(name))
{
window.alert(“Please enter your name properly.”);
name.focus();
return false;
}
if (address == “”)
{
window.alert(“Please enter your address.”);
address.focus();
return false;
}
if (email == “” || !regEmail.test(email))
{
window.alert(“Please enter a valid e-mail address.”);
email.focus();
return false;
}
if (password == “”)
{
alert(“Please enter your password”);
password.focus();
return false;
}
if(password.length <6)
{
alert(“Password should be atleast 6 character long”);
password.focus();
return false;
}
if (phone == “” || !regPhone.test(phone))
{
alert(“Please enter valid phone number.”);
phone.focus();
return false;
}
if (what.selectedIndex == -1) {
alert(“Please enter your course.”);

8
what.focus();
return false;
}
return true;
}
</script>
<style>
div
{
box-sizing: border-box;
width: 100%;
border: 100px solid black;
float: left;
align-content: center;
align-items: center;
}
form
{
margin: 0 auto;
width: 600px;
}
</style>
</head>
<body>
<h1 style=”text-align: center;”>REGISTRATION FORM</h1>
<form name=”RegForm” onsubmit=”return GEEKFORGEEKS()” method=”post”>
<p>Name: <input type=”text” size=”65” name=”Name” /></p>
<br />
<pAddress: <input type=”text” size=”65” name=”Address” />
</p>
<br />
<p>E-mail Address: <input type=”text” size=”65” name=”Email” /></p>
<br />
<p>Password: <input type=”text” size=”65” name=”Password” /></p>
<br />
<p>Telephone: <input type=”text” size=”65” name=”Telephone” /></p><br />
<p>
SELECT YOUR COURSE
<select type=”text” value=”” name=”Subject”>
<option>BTECH</option>
<option>BBA</option>
<option>BCA</option>
<option>B.COM</option>
<option>GEEKFORGEEKS</option>
</select>
</p>
<br /><br />
<p>Comments: <textarea cols=”55” name=”Comment”> </textarea></p>
<p>
<input type=”submit” value=”send” name=”Submit” />
<input type=”reset” value=”Reset” name=”Reset” />
</p>
</form>
</body></hrml>

9
RESULT:
Thus the program is implemented, executed successfully and the output is
verified.

10
EX.NO:4 POPUP WINDOW PAGE NO:
DATE:

AIM:
To Write a JavaScript Program To Create Popup Window.

ALGORITHM:
1. Start → Open Notepad++

2. Click File→New File→Enter the File Name with the .html extension

3. Enter the Code to create a popup window embed with JavaScript.

4. Run the code in the Web browser.

5. Save and execute the program.

11
PROGRAM:
<html>
<body bgcolor="green">
<a href="pop.html" onclick="return NewWindow('https://www.google.com/')"><center><font
size=20>CLICK TO HAVE A POPUP WINDOW</font> </center></a>
<script language="javascript" type="text/javascript">
function NewWindow(url)
{
newwindow=window.open(url,'name','height=400,width=400').focus();
if (window.focus) {newwindow.focus()}
return false;
}
</script>
</body>
</html>

12
OUTPUT:

RESULT:
Thus the program is implemented, executed successfully and the output is
verified.

13
EX.NO:5 EVENT HANDLER PAGE NO:
DATE:

AIM:
To An Html Form With A JavaScript Event Handler

ALGORITHM:
1. Start → Open Notepade++

2. Click File→New File→Enter the File Name with the .html extension

3. Enter the Code to create different event handling embedded with JavaScript.

4. Run the code in the Web browser.

5. Save and execute the program.

14
PROGRAM:
<!DOCTYPE html>
<html>
<body>
<center>
<h1 style="color: green;">
EVENT HANDLING
</h1>
<input type="text" name="blur" id="blur"
onblur="BlurFunction()"
placeholder="Enter Name" />
<br /><br />
<select id="course" onchange="OnChangeFunction()">
<option value="Competitive Programming">
Competitive Programming
</option>
<option value="Operating System">
Operating System
</option>
<option value="Web Development">
Web Development
</option>
<option value="Android Development">
Android Development
</option>
</select>
<p id="demo"></p>
<br /><br />
<input type="text" id="focus"
onfocus="FocusFunction(this.id)"
placeholder="Enter Your Semester" /><br />
</center>
<script>
function BlurFunction()
{
let x = document.getElementById("blur");

15
x.value = x.value.toUpperCase();
}
function OnChangeFunction()
{
let x = document.getElementById("course").value;
document.getElementById("demo")
.innerHTML = "You selected: " + x;
}
function FocusFunction(x)
{
document.getElementById(x)
.style.background = "green";
}
</script>
</body>
</html>

16
OUTPUT:

RESULT:
Thus the program is implemented, executed successfully and the output is
verified.

17
EX.NO:6 DROPDOWN LIST PAGE NO:
DATE:

AIM:
To Write a JavaScript Program To Remove Items From A Dropdown List
ALGORITHM:
1. Start → Open Notepad++

2. Click File→New File→Enter the File Name with the .html extension

3. Enter the Code to create dropdown list embedded with JavaScript.

4. Run the code in the Web browser.

5. Save and execute the program.

18
PROGRAM:
<!DOCTYPE html>
<html>
<body background=https://media.geeksforgeeks.org/wp-content/uploads/rk.png>
<font face="Arial" size="15">
<p>Select any option and click the button to remove the selected option.</p>
<form id = "myForm">
<select id = "id_dropdown">
<option>One</option>
<option>Two</option>
<option>Three</option>
</select>
<input type = "button" onclick = "fun_remove()" value = "Click to Remove">
</form>
<script>
function fun_remove() {
var element = document.getElementById("id_dropdown");
element.remove(element.selectedIndex);
}
</script>
</font>
</body>
</html>

19
OUTPUT:

RESULT:
Thus the program is implemented, executed successfully and the output is
verified.

20
EX.NO:7 DISPLAY RANDOM IMAGE PAGE NO:
DATE:

AIM:
To Write a JavaScript Program To Display A Random Image
ALGORITHM:
1. Start → Open Notepad++

2. Click File→New File→Enter the File Name with the .html extension

3. Enter the Code to display random image list embedded with JavaScript.

4. Run the code in the Web browser.

5. Save and execute the program.

21
PROGRAM:
<html>
<head>
<title>Display a random image.</title>
</head>
<body>
<font face="Arial" size="5" color="green">
<h1><center>DISPLAY RANDOM IMAGE</center></h1>
</font>
<div>
<button id="jsstyle"
onclick="display_random_image();"><font face="Arial" size="10" color="blue">Show
Image</font></button>
<script>
function display_random_image()
{
var theImages = [{
src: "http://farm4.staticflickr.com/3691/11268502654_f28f05966c_m.jpg",
width: "300",
height: "300"
},
{
src: "http://farm1.staticflickr.com/33/45336904_1aef569b30_n.jpg",
width: "300",
height: "300"
},
{
src: "https://images.pexels.com/photos/858115/pexels-photo-
858115.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500",
width: "300",
height: "300"
}];
var preBuffer = [];
for (var i = 0, j = theImages.length; i < j; i++) {
preBuffer[i] = new Image();
preBuffer[i].src = theImages[i].src;
preBuffer[i].width = theImages[i].width;
preBuffer[i].height = theImages[i].height;
}
// create random image number
function getRandomInt(min,max)
{
// return Math.floor(Math.random() * (max - min + 1)) + min;
imn = Math.floor(Math.random() * (max - min + 1)) + min;
return preBuffer[imn];
}
// 0 is first image, preBuffer.length - 1) is last image
var newImage = getRandomInt(0, preBuffer.length - 1);
// remove the previous images
var images = document.getElementsByTagName('img');

22
var l = images.length;
for (var p = 0; p < l; p++) {
images[0].parentNode.removeChild(images[0]);
}
// display the image
document.body.appendChild(newImage);
}
</script>
</div>
</body>
</html>

23
OUTPUT:

RESULT:
Thus the program is implemented, executed successfully and the output is
Verified.

24
EX.NO:8 E-MAIL VALIDATION PAGE NO:
DATE:

AIM:
To Write a JavaScript Program To Valid An Email Address.
ALGORITHM:
1. Start → Open Notepad++

2. Click File→New File→Enter the File Name with the .html extension

3. Enter the Code to validate the E-Mail Address embedded with JavaScript.

4. Run the code in the Web browser.

5. Save and execute the program.

25
PROGRAM:
<html>
<head>
<script>
function validateEmail(emailId)
{
var mailformat = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
if(emailId.value.match(mailformat))
{
document.form1.text1.focus();
return true;
}
else
{
alert("Invalid email address.");
document.form1.text1.focus();
return false;
}
}
</script>
</head>
<body bgcolor="yellow">
<div>
<h1><center>JavaScript email validation</center></h1>
<form name="form1" action="#">
Email: <input type='text' name='email'/></br></br>
<input type="submit" name="submit" value="Submit"
onclick="validateEmail(document.form1.email)"/>
</form>
</div>
</body>
</html>

26
OUTPUT:

RESULT:
Thus the program is implemented, executed successfully and the output is
verified.

27
JAVA SERVER
PAGES
PROGRAMS

28
EX.NO:9 ADD CONTENTS TO JSP FILE PAGE NO:
DATE:

AIM:

To Write a JSP to add the contents of another JSP file using @include directive.
ALGORITHM:
1. Start → Open Notepad++

2. Click File→New File→Enter the File Name Home with the .jsp extension

3. Create another file Header.jsp and Footer.jsp.

4. Save the jsp file in the path “C:\Program Files\Apache Software Foundation\Tomcat

11.0\webapps\ROOT”.

5. Enter the Necessary Code to the files.

6. Run the file Home.jsp e in the localhost.

7. Save and execute the program.

29
PROGRAM:
Home.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<%@ include file="header.jsp"%>
</head>
<body>
<h3>Welcome to Codebun.com</h3>
</body>
<%@ include file="footer.jsp"%>
</html>
Header.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h1>HEADER</h1>
</body>
</html>
Footer.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h1>FOOTER</h1>
</body>
</html>

30
OUTPUT:

RESULT:
Thus the program is implemented, executed successfully and the output is
verified.

31
EX.NO:10 PRIME NUMBER CHECKING PAGE NO:
DATE:

AIM:
To Write a JSP to check whether the given number is prime or not.

ALGORITHM:
1. Start → Open Notepad++

2. Click File→New File→Enter the File Name Prime with the .html extension

3. Create another file Prime.jsp.

4. Save the jsp file in the path “C:\Program Files\Apache Software Foundation\Tomcat

11.0\webapps\ROOT”.

5. Enter the Necessary Code to the files.

6. Run the file Prime.html in the localhost.

7. Save and execute the program.

32
PROGRAM:
Prime.html
<html>
<head>
<title>Prime Number JSP program</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
</head>
<body>
<form action="http://localhost:2525/prime.jsp" method="post">
<font face="Arial" size="5">
Enter Any Number:
<input type="text" name="t1" >
<font>
<br>
<input type="submit" >
</form>
</body>
</html>

Prime.jsp
<%
int n=Integer.parseInt(request.getParameter("t1"));
out.println(" The given number is: "+n);
int d=2;
while(d<n)
{
if(n%d==0)
{
out.println("<br> "+n+" is not Prime number.");
break;
}
else
d++;
}
if(n==d)

out.println("<br>"+n+" is Prime number.");

%>

33
OUTPUT:

RESULT:
Thus the program is implemented, executed successfully and the output is
verified.

34
EX.NO:11 FORWARD CONTENTS TO JSP FILE PAGE NO:
DATE:

AIM:
To Write a JSP to forward one JSP file to another JSP file using forward action.

ALGORITHM:
1. Start → Open Notepad++

2. Click File→New File→Enter the File Name Home with the .jsp extension

3. Create another file Display.jsp.

4. Save the jsp file in the path “C:\Program Files\Apache Software Foundation\Tomcat

11.0\webapps\ROOT”.

5. Enter the Code to forward the contents of the files.

6. Run the file Display.jsp in the localhost.

7. Save and execute the program.

35
PROGRAM:
Home.jsp
<html>
<head>
<title>JSP forward example with parameters</title>
</head>
<body bgcolor="pink">
<jsp:forward page="display.jsp">
<jsp:param name="name" value="Chaitanya" />
<jsp:param name="site" value="BeginnersBook.com" />
<jsp:param name="tutorialname" value="jsp forward action" />
<jsp:param name="reqcamefrom" value="index.jsp" />
</jsp:forward>
</body>
</html>

Display.jsp
<html>
<head>
<title>Display Page</title>
</head>
<body bgcolor="pink">
<font face="Arial" Size="4">
<h2>Hello this is a display.jsp Page</h2>
My name is: <%=request.getParameter("name") %><br>
Website: <%=request.getParameter("site") %><br>
Topic: <%=request.getParameter("tutorialname") %><br>
Forward Request came from the page: <%=request.getParameter("reqcamefrom") %>
</font>
</body>
</html>

36
OUTPUT:

RESULT:
Thus the program is implemented, executed successfully and the output is
verified.

37
ASP .NET
PROGRAMS

38
EX.NO:12 WORKING WITH PAGE AND FORMS PAGE NO:
DATE:

AIM:
To Work with Page and Forms Using Asp .Net.

ALGORITHM:
1. Start→Microsoft Visual Studio 2022

2. Select Create a new project On the Create a new project window.


3. Select ASP.Net Web Application(.NET Framework) then click Next.
4. Enter the Project Name and Location for save the project then click Create.
5. Choose Empty Web form then click Create.
6. Rename the webform and Save it.
7. Click Solution Explorer→ right click in project name select Add→ New
Item→Webform and rename it.
8. Add necessary controls (Label, Textbox, Button) and change its necessary
properties to validate the form.
9. In Solution Explorer open the code-behind file (REG.aspx.cs), add the code to
validate the registration details.
10. Click the debugging button to run the program.

PROPERTIES TABLE:
Controls Property Value
Label1 ID, Text lblUsername
Label2 ID, Text lbllastname
Label3 ID,Text lblEmail
Label4 ID,Text lblgender
TextBox1 ID txtFirstName
TextBox1 ID txtLastName
TextBox1 ID txtEmail
Dropdownlist1 ID ddlGender
Button1 ID btnSubmit

39
PROGRAM:
REG.ASPX:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="REG.aspx.cs"
Inherits="PAGEANDFORMS.REG" %>
<!DOCYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Student Registration Form</title>
</head>
<body>
<form id="form1" runat="server">
<h1><font color="green" size="6"><center>STUDENT REGISTRATION FORM </center>
</font></h1>
<font color="red" face="Arial" size="4">
<div>
<label for="txtFirstName">First Name:</label>
<asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox><br /><br />
</div>
<div>
<label for="txtLastName">Last Name:</label>
<asp:TextBox ID="txtLastName" runat="server"></asp:TextBox><br /><br />
</div>
<div>
<label for="txtEmail">Email:</label>
<asp:TextBox ID="txtEmail" runat="server"></asp:TextBox><br /><br />
</div>
<div>
<label for="ddlGender">Gender:</label>
<asp:DropDownList ID="ddlGender" runat="server">
<asp:ListItem Text="Select" Value="" />
<asp:ListItem Text="Male" Value="Male" />
<asp:ListItem Text="Female" Value="Female" />
</asp:DropDownList><br /><br />
</div>
<div>
<asp:Button ID="btnSubmit" runat="server" Text="Submit"
OnClick="btnSubmit_Click" ForeColor="Blue" /><br /><br />
</div>
</font>
</form>
</body>
</html>

40
REG.ASPX.CS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PAGEANDFORMS
{
public partial class REG : System.Web.UI.Page
{
protected void btnSubmit_Click(object sender, EventArgs e)
{
string firstName = txtFirstName.Text;
string lastName = txtLastName.Text;
string email = txtEmail.Text;
string gender = ddlGender.SelectedValue;

// Process the submitted data (you can save it to a database, etc.)


string message = $"Registration Successful! Name: {firstName} {lastName},
Email: {email}, Gender: {gender}";
ClientScript.RegisterStartupScript(GetType(), "alert",
$"alert('{message}');", true);
}
}
}

41
FORM DESIGN:

OUTPUT:

RESULT:
Thus the program is implemented, executed successfully and the output is
verifie

42
EX.NO:13 REGISTRATION FORM USING PAGE NO:
VALIDATION CONTROLS
DATE:

AIM:
Write a program to Create An Account Registration Form And Perform the
Validation
ALGORITHM:
11. Start→Microsoft Visual Studio 2022

12. Select Create a new project On the Create a new project window.
13. Select ASP.Net Web Application(.NET Framework) then click Next.
14. Enter the Project Name and Location for save the project then click Create.
15. Choose Empty Web form then click Create.
16. Rename the webform and Save it.
17. Click Solution Explorer→ right click in project name select Add→ New
Item→Webform and rename it.
18. Add necessary controls (Label, Textbox, Button, Validation controls) and change
its necessary properties to validate the form.
19. In Solution Explorer open the code-behind file (valid.aspx.cs), add the code to
validate the registration details.
20. Click Solution Explorer→ right click in project name select Add→ New
Item→Webform and rename it as Successpage.aspx and enter code for successful
registration.
21. Click the debugging button to run the program.

43
PROPERTIES TABLE:

Controls Property Value


Label1 ID,Text lblUsername
Label2 ID,Text lblEmail
Label3 ID,Text lblPassword
Label4 ID,Text lblConfirmPassword
Label5 ID,Text lblDate
Label6 ID,Text lblmobile
TextBox1 ID txtUsername
TextBox2 ID txtEmail
TextBox3 ID txtPassword
TextBox4 ID txtConfirmPassword
TextBox5 ID txtDate
TextBox6 ID txtmobile
RequiredFieldValidator1 ID,ControlToValidate rfvUsername,txtUsername
RequiredFieldValidator2 ID,ControlToValidate rfvEmail, txtEmail
RequiredFieldValidator3 ID,ControlToValidate rfvPassword
RequiredFieldValidator4 ID,ControlToValidate rfvConfirmPassword
RequiredFieldValidator5 ID,ControlToValidate rfvDate, txtPassword
RegularExpressionValidator ID,ControlToValidate revEmail, txtEmail
CompareValidator ID,ControlToValidate cvConfirmPassword,
txtConfirmPassword
RangeValidator ID,ControlToValidate Rvmobile, txtmobile
Button1 ID,Text,Onclick btnSubmit,Register,
btnSubmit_Click

44
PROGRAM:
Valid.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="valid.aspx.cs"
Inherits="validation.valid" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>REGISTRATION FORM</title>
</head>
<body>
<form id="form1" runat="server">
<h1><center>REGISTRAION FORM USING VALIDATION CONTROLS</center></h1>
<div>
<h2>Account Registration Form</h2>
<asp:Label ID="lblUsername" runat="server" Text="Username"></asp:Label>
<asp:TextBox ID="txtUsername" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvUsername" runat="server"
ControlToValidate="txtUsername"
ErrorMessage="Username is required"
ForeColor="Red"></asp:RequiredFieldValidator>
<br /><br />
<asp:Label ID="lblEmail" runat="server" Text="Email"></asp:Label>
<asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvEmail" runat="server"
ControlToValidate="txtEmail"
ErrorMessage="Email is required"
ForeColor="Red"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="revEmail" runat="server"
ControlToValidate="txtEmail"
ErrorMessage="Invalid Email" ValidationExpression="\w+([-+.']\w+)*@\w+([-
.]\w+)*\.\w+([-.]\w+)*">
</asp:RegularExpressionValidator>
<br /><br />
<asp:Label ID="lblPassword" runat="server" Text="Password"></asp:Label>
<asp:TextBox ID="txtPassword" runat="server"
TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvPassword" runat="server"
ControlToValidate="txtPassword"
ErrorMessage="Password is required"
ForeColor="Red"></asp:RequiredFieldValidator>
<br /><br />
<asp:Label ID="lblConfirmPassword" runat="server" Text="Confirm
Password"></asp:Label>
<asp:TextBox ID="txtConfirmPassword" runat="server"
TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvConfirmPassword" runat="server"
ControlToValidate="txtConfirmPassword"
ErrorMessage="Confirm Password is required"
ForeColor="Red"></asp:RequiredFieldValidator>

45
<asp:CompareValidator ID="cvConfirmPassword" runat="server"
ControlToValidate="txtConfirmPassword"
ControlToCompare="txtPassword" ErrorMessage="Passwords do not match"
ForeColor="Red">
</asp:CompareValidator>
<br /><br />
<div>
<asp:Label ID="lblDate" runat="server" Text="Enter Date:"></asp:Label>
<asp:TextBox ID="txtDate" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvDate" runat="server"
ControlToValidate="txtDate"
ErrorMessage="Date is required" ForeColor="Red"></asp:RequiredFieldValidator>
</div>
<br /><br />
<div>
<asp:Label ID="lblmobile" runat="server" Text="Enter Mobile
Number:"></asp:Label>
<asp:TextBox ID="txtmobile" runat="server"></asp:TextBox>
<asp:RangeValidator ID="rvmobile" runat="server" ErrorMessage="Mobile Number
Should be 10 digit long" ControlToValidate="txtmobile"
MaximumValue="9999999999" MinimumValue="1000000000"
ForeColor="Red"></asp:RangeValidator>
</div>
</div>
<!-- Add more input fields and validators for other details like email,
password, etc. -->
<br /><br />
<div>
<asp:Button ID="btnSubmit" runat="server" Text="Register"
OnClick="btnSubmit_Click" ForeColor="Black" /></div>
</form>
</body>
</html>

46
Valid.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace validation
{
public partial class valid : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// Perform actions on initial page load
}
}

protected void btnSubmit_Click(object sender, EventArgs e)


{
if (Page.IsValid)
{
// If all validation controls pass, perform registration logic
string username = txtUsername.Text;
string email = txtEmail.Text;
string password = txtPassword.Text;

// Retrieve other form values and perform necessary actions


// Example: save data to a database, register the user, etc.
// Redirect to a success page or show a success message
Response.Redirect("SuccessPage.aspx");
}
}
}
}

47
FORM DESIGN:

OUTPUT:

48
RESULT:
Thus the program is implemented, executed successfully and the output is
verified.

49
EX.NO:14 STUDENT DETAILS USING XML FILE PAGE NO:
DATE:

AIM:
Write a program to Read Student Details From Xml File

ALGORITHM:
1. Start→Microsoft Visual Studio 2022

2. Select Create a new project On the Create a new project window.


3. Select ASP.Net Web Application(.NET Framework) then click Next.
4. Enter the Project Name and Location for save the project then click Create.
5. Choose Empty Web form then click Create.
6. Rename the webform and Save it.
7. Click Solution Explorer→ right click in project name select Add→ New
Item→XML File and type the content and save it as stuent.xml.
8. In Solution Explorer open the code-behind file (Default.aspx.cs), add the code to
read and display the student details.
9. Click the debugging button to run the program.

50
PROGRAM:
student.xml
<?xml version="1.0" encoding="utf-8" ?>
<Students>
<Student>
<Name>John Doe</Name>
<Age>20</Age>
<Grade>A</Grade>
</Student>
<Student>
<Name>Jane Smith</Name>
<Age>22</Age>
<Grade>B</Grade>
</Student>
<!-- Add more student details if needed -->
</Students>

student.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.Xml;
namespace studentxm
{
public partial class stu : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string xmlFilePath = Server.MapPath("~/student.xml");
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlFilePath);
XmlNodeList studentNodes = xmlDoc.SelectNodes("//Student");
foreach (XmlNode studentNode in studentNodes)
{
string name = studentNode.SelectSingleNode("Name").InnerText;
string age = studentNode.SelectSingleNode("Age").InnerText;
string grade = studentNode.SelectSingleNode("Grade").InnerText;
string studentInfo = $"Name: {name}, Age: {age}, Grade: {grade}";
Response.Write(studentInfo + "<br/>");
}
}
}
}
}

51
OUTPUT:

RESULT:
Thus the program in implemented, executed successfully and the output is
verified.

52
EX.NO:15 VEHICLE DETAILS USING TREEVIEW PAGE NO:
CONTROL AND XML FILE
DATE:

AIM:
Write a program to Display Vehicle Details In Tree View Control From Xml File
ALGORITHM:
1. Start→Microsoft Visual Studio 2022

2. Select Create a new project On the Create a new project window.


3. Select ASP.Net Web Application(.NET Framework) then click Next.
4. Enter the Project Name and Location for save the project then click Create.
5. Choose Empty Web form then click Create.
6. Rename the webform and Save it.
7. Design the form using necessary controls.
8. Click Solution Explorer→ right click in project name select Add→ New
Item→XML File and type the content and save it as vehicle.xml.

STEPS FOR BOUNDING DATA INTO XML FILE:


9. In tool bar choose Navigation→Tree View.
10. Right click the Treeview→Edit Nodes.
11. Add Root Node, then add a Child Node & then click ok.
12. In the Solution Explorer, right click in project name add new items.
13. In toolbar choose Data→XML Data Source.
14. Click in the Tree View Smart Palette→Choose Data Source→XML Data Source.
15. In the XML Data Source Property, click on the Data file→vehicle.xml.
16. Click the debugging button to run the program.

53
PROGRAM:
Vehicle.xml
<?xml version="1.0" encoding="utf-8" ?>
<VEHICLETYPES>
<TWOWHEELER>
<HONDAACTIVA> </HONDAACTIVA>
<SCOOTYZEST> </SCOOTYZEST>
<BAJAJPULSAR></BAJAJPULSAR>
<ROYALEFNFILED></ROYALEFNFILED>
</TWOWHEELER>
<FOURWHEELER>
<LIGHTVEHICLE>
<TATAPUNCH> </TATAPUNCH>
<HONDACITY></HONDACITY>
<FORDICON></FORDICON>
<JEEP></JEEP>
<INNOVA></INNOVA>
</LIGHTVEHICLE>
<HEAVYVEHICLE>
<TRUCK></TRUCK>
<BUS></BUS>
<CRANE></CRANE>
</HEAVYVEHICLE>
</FOURWHEELER>
</VEHICLETYPES>

View.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="VIEW.aspx.cs"
Inherits="TREE.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>TREEVIEW CONTROL</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<center> <asp:Label ID="Label1" runat="server" Text="VEHICLE DETAILS USING
TREEVIEW CONTROL" Font-Bold="True" Font-Size="Large"
ForeColor="#000099"></asp:Label> </center>
</div>
<div>
<asp:TreeView ID="TreeView1" runat="server" DataSourceID="XmlDataSource1"
ForeColor="#009999">
<Nodes>

54
<asp:TreeNode Text="New Node" Value="New Node">
<asp:TreeNode Text="New Node" Value="New Node">
<asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode>
<asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode>
<asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode>
<asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode>
</asp:TreeNode>
<asp:TreeNode Text="New Node" Value="New Node">
<asp:TreeNode Text="New Node" Value="New Node">
<asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode>
<asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode>
<asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode>
</asp:TreeNode>
<asp:TreeNode Text="New Node" Value="New Node">
<asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode>
<asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode>
<asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode>
</asp:TreeNode>
</asp:TreeNode>
</asp:TreeNode>
</Nodes>
<NodeStyle ForeColor="#CC0000"></NodeStyle>
</asp:TreeView>
<asp:XmlDataSource runat="server" ID="XmlDataSource1"
DataFile="~/vehicle.xml"></asp:XmlDataSource>
</div>
<div>&nbsp;</div>
<div>
<asp:XmlDataSource runat="server"
DataFile="~/vehicle.xml"></asp:XmlDataSource>
&nbsp;</div>
</form>
</body>
</html>

55
FORM DESIGN:

OUTPUT:

RESULT:
Thus the program is implemented, executed successfully and the output is
verified.

56
EX.NO:16 MENU SERVER CONTROL PAGE NO:
DATE:

AIM:

To Create an Application Program Using Menu Server Control

ALGORITHM:
1. Start→Microsoft Visual Studio 2022

2. Select Create a new project On the Create a new project window.


3. Select ASP.Net Web Application(.NET Framework) then click Next.
4. Enter the Project Name and Location for save the project then click Create.
5. Choose Empty Web form then click Create.
6. Rename the webform and Save it.
7. Click Solution Explorer→ right click in project name select Add→ New
Item→Web forms Master Page.
8. Design the Master page with Menu control by Select
Toolbar→Navigation→Menu and Right Click Menu→Edit Menu Items→Add
Items.
9. Click Solution Explorer→ right click in project name select Add→ New
Item→Web forms with Master Page.
10. Rename the web form as HOME.aspx with Site Master1 and add the contents of
the page.
11. Repeat step 9 and create COURSES.ASPX, ABOUT.ASPX, CONTACT.ASPX web
forms and the contents of each page.
12. Choose Menu→Right Click→Properties→Navigate URL→Choose the relevant
menu’s Web form name and link it.
13. Run the HOME.aspx web form.
14. Click the debugging button to run the program.

57
PROGRAM:
Site1.Master:

<!DOCTYPE html>
<html>
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<br class="Apple-interchange-newline">
<div>
<center> <asp:Image ID="Image1" runat="server" ImageUrl="~/soft.png"
BackColor="#9999FF" ImageAlign="Top" BorderColor="Blue" BorderStyle="Double"
ForeColor="#0066FF" /></center>
</div>
<asp:Menu ID="Menu1" runat="server" ForeColor="#000099"
Orientation="Horizontal" BorderStyle="Solid">
<Items>
<asp:MenuItem Text="HOME" Value="HOME"
NavigateUrl="HOME.aspx"></asp:MenuItem>
<asp:MenuItem Text="COURSES" Value="COURSES">
<asp:MenuItem NavigateUrl="~/DOTNET.aspx" Text="DOT NET" Value="DOT
NET"></asp:MenuItem>
<asp:MenuItem NavigateUrl="~/PYTHON.aspx" Text="PYTHON"
Value="PYTHON"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem NavigateUrl="~/ABOUT.aspx" Text="ABOUT"
Value="ABOUT"></asp:MenuItem>
<asp:MenuItem NavigateUrl="~/CONTACT.aspx" Text="CONTACT"
Value="CONTACT"></asp:MenuItem>
</Items>
</asp:Menu>
<div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
</asp:ContentPlaceHolder>
<asp:ContentPlaceHolder ID="ContentPlaceHolder3" runat="server">
</asp:ContentPlaceHolder>
<br /><br /><br />
<asp:Label ID="Label1" runat="server" Text="@Developed By SoftInfoTech" Font-
Bold="True" Font-Size="X-Large" ForeColor="#6600FF" Font-

58
Italic="True"></asp:Label><%@ Master Language="C#" AutoEventWireup="true"
CodeBehind="Site1.master.cs" Inherits="MENUCONTROL.Site1" %>
</form>
</body>
</html>
Home.aspx:
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master"
AutoEventWireup="true" CodeBehind="HOME.aspx.cs"
Inherits="MENUCONTROL.WebForm2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
<div>
<font face="Arial" color="Green" size="4">
In today’s society, knowing how to computer program is one of the most valuable
skills somebody can possess. It is an essential tool that enables us to
communicate with computers and complete tasks. It has a wide range of uses,
from managing businesses to creating new products. The importance of computer
programming cannot be understated. It helps us solve problems and carry out
tasks more efficiently. It also allows us to automate processes and create new
ways of doing things. Computer programming is a highly sought-after skill in
an increasingly technological world.
</font>
</div>
</asp:Content>
ASP.NET.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master"
AutoEventWireup="true" CodeBehind="DOTNET.aspx.cs"
Inherits="MENUCONTROL.DOTNET" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="server"><br />
<font face="Arial" color="Green" size="4">
NET is an open-source platform for building desktop, web, and mobile
applications that can run natively on any operating system. The .NET system
includes tools, libraries, and languages that support modern, scalable, and
high-performance software development. An active developer community maintains
and supports the .NET platform.
These are the three main .NET components:
.NET languages
Application model frameworks
.NET runtime
</font>

</asp:Content>

59
PYTHON.ASPX:
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master"
AutoEventWireup="true" CodeBehind="PYTHON.aspx.cs"
Inherits="MENUCONTROL.PYTHON" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2"
runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder3"
runat="server">
<font face="Arial" color="Green" size="4">
Python is an interpreted, object-oriented, high-level programming language
with dynamic semantics. Its high-level built in data structures, combined with
dynamic typing and dynamic binding, make it very attractive for Rapid
Application Development, as well as for use as a scripting or glue language to
connect existing components together. Python's simple, easy to learn syntax
emphasizes readability and therefore reduces the cost of program maintenance.
Python supports modules and packages, which encourages program modularity and
code reuse. The Python interpreter and the extensive standard library are
available in source or binary form without charge for all major platforms, and
can be freely distributed.
</font>
<br />
</asp:Content>

ABOUT.ASPX
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master"
AutoEventWireup="true" CodeBehind="ABOUT.aspx.cs"
Inherits="MENUCONTROL.ABOUT" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2"
runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder3"
runat="server">
<font face="Arial" color="Green" size="4">
We listen and understand our clients' need and requirements in detail. We then
analyze the type of software development which would best suit interest of our
client without rocketing cost, yet providing the best industry standard output.
For us, every obstacle or problem is a chance to prove our capabilities.
Once we hear the word "go," our elite workforce works tirelessly and endlessly
through storm and thunder to realize the dreams of our clients. We will stand

60
by the commitment we had given to our clients in terms of quality, deliverance,
and cost.
We always keep our clients in safe zone at all times. We know that our
performance and delivery will have its own effects on our clients. Thus, we
perform and deliver positively which contributes positive effect to our
clients.
</font>
<br />
</asp:Content>

CONTACT.ASPX:
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master"
AutoEventWireup="true" CodeBehind="CONTACT.aspx.cs"
Inherits="MENUCONTROL.CONTACT" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2"
runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder3"
runat="server">
<font face="Arial" color="Green" size="4">
Softwhere Skill and Training Institute<br />
112, 4th Floor<br />
Chennai<br />
Tamilnadu<br />
</font>
</asp:Content>

61
OUTPUT:

RESULT:
Thus the program is implemented, executed successfully and the output is
verified.

62
EX.NO:17 STUDENT DATABASE USING PAGE NO:
SQLDATASOURCE CONTROL
DATE:

AIM:
Write a Program to Process Student Database Using Sqldatasource Control

ALGORITHM:
1. Start→Microsoft Visual Studio 2022

2. Select Create a new project On the Create a new project window.


3. Choose Create a New Project→SQL Server Database Project. Give the
Project(Database) name and Location and click Create.
4. Select→View→Server Explorer→Right click→Add connection→Enter the
database name→ok
5. Right-click the database name→Tables→Right click→Add new table.
6. Use the Table create query to create the table

Table Creation:
CREATE TABLE Students (
StudentID INT PRIMARY KEY IDENTITY(1,1),
FirstName NVARCHAR(50),
LastName NVARCHAR(50),
Age INT,
Grade NVARCHAR(10)
)

7. Use Create table query to build the table and update →Update database.
8. Right-click the table name→Show Table data to enter the data then refresh it.

Creating Web form:

1. Select Create a new project On the Create a new project window.


2. Select ASP.Net Web Application(.NET Framework) then click Next.
3. Enter the Project Name and Location for save the project then click Create.
4. Choose Empty Web form then click Create.
5. Rename the web form and Save it.

63
6. Go to design view of aspx page→add GridView and SQLDataSource from toolbox.
7. Set the necessary Properties of the controls.
8. In the web.config xml file add the following code to made database connection

<connectionStrings>
<add name="YourConnectionString" connectionString="Data Source=Data
Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\ASUS\Documents\st
udent.mdf;Integrated Security=True;Connect Timeout=30;Initial
Catalog=StudentDB;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>

9. Click the debugging button to run the program.

PROPERTIES TABLE:
CONTROL PROPERTY VALUE
GridView1 DatasourceID SqlDatasource1
SqlDatasource1 ConnectionString <connectionStrings>
<add name="YourConnectionString" connectionString="Data
Source=Data
Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\A
SUS\Documents\student.mdf;Integrated Security=True;Connect
Timeout=30;Initial Catalog=StudentDB;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>

Providername System.Data.SqlClient
SelectQuery Select from Table

64
PROGRAM:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="STU.aspx.cs"
Inherits="STUDENTDB.STU" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>STUDENT DATABASE</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<center><h2>STUDENT DETAILS USING DATABASE</h2></center>
</div>
<div>
<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1"
BorderColor="#6600CC" BackColor="#0099FF"></asp:GridView>
</div>
<div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ProviderName="System.Data.SqlClient" ConnectionString="Data
Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\APC-
NL\Documents\student.mdf;Integrated Security=True;Connect Timeout=30"
SelectCommand="SELECT Students.* FROM Students"></asp:SqlDataSource>
</div>
</form>
</body>
</html>

65
OUTPUT:
FORM DESIGN:

DATABASE:

66
RESULT:
Thus the program is implemented, executed successfully and the output is
verified.

67
EX.NO:18 EMPLOYEE DETAILS USING PAGE NO:
SITEMAPDATASOURCE
DATE:

AIM:
To Display Employee Details From The Database Using Sitemapdatasource.

ALGORITHM:
1. Start→Microsoft Visual Studio 2022

2. Select Create a new project On the Create a new project window.


3. Select ASP.Net Web Application(.NET Framework) then click Next.
4. Enter the Project Name and Location for save the project then click Create.
5. Choose Empty Web form then click Create.
6. Rename the webform and Save it.
7. Insert Treeview and Sitemapdatasource from the toolbox and set necessary
properties.
8. Click Solution Explorer→ right click in project name select Add→ New
Item→Sitemap.
9. Add the code to display employee details.
10. Click Solution Explorer→ right click on project name select Add→ New
Item→Webforms(emp1,emp2,emp3,emp4,emp5.aspx) and add details about the
employee.
11. Click the debugging button to run the program.

68
PROGRAM:
Web.sitemap
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
<siteMapNode url="~/Employees" title="Employees" description="Employee
Information">
<siteMapNode url="~/emp1.aspx?employeeId=1" title="John Doe"
description="Details for John Doe" />
<siteMapNode url="~/emp2.aspx?employeeId=2" title="Jane Smith"
description="Details for Jane Smith" />
<siteMapNode url="~/emp3.aspx?employeeId=3" title="Adam" description="Details
for Adam" />
<siteMapNode url="~/emp4.aspx?employeeId=4" title="Kiran"
description="Details for Kiran" />
<siteMapNode url="~/emp5.aspx?employeeId=5" title="Jerry"
description="Details for Jerry" />
</siteMapNode>
</siteMap>

Employeedetails.aspx
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="EmployeeDetails.aspx.cs" Inherits="SITEMAP.EmployeeDetails" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TreeView ID="TreeView1" runat="server"
DataSourceID="SiteMapDataSource1"></asp:TreeView>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
</div>
</form>
</body>
</html>
Emp1.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="emp1.aspx.cs"
Inherits="SITEMAP.emp1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
69
NAME : JOHN DOE
AGE: 46
SALARY : 12000
MAIL: [email protected]
</div>
</form>
</body>
</html>

FORM DESIGN:

70
OUTPUT:

RESULT:
Thus the program is implemented, executed successfully and the output is
verified.

71
EX.NO:19 PERSONAL DATABASE USING PAGE NO:
XMLDATASOURCE CONTROL
DATE:

AIM:
Write a program to Read and Display Personal Database Using Xmldatasource
Control

ALGORITHM:
1. Start→Microsoft Visual Studio 2022

2. Select Create a new project On the Create a new project window.


3. Select ASP.Net Web Application(.NET Framework) then click Next.
4. Enter the Project Name and Location for save the project then click Create.
5. Choose Empty Web form then click Create.
6. Rename the webform and Save it.
7. Click Solution Explorer→ right click in project name select Add→ New
Item→XML File and type the content and save it as personal.xml.

STEPS FOR BOUNDING DATA INTO XML FILE:


8. In tool bar choose Data→Grid View.
9. In toolbar choose Data→XML Data Source.

10. Set the Data properties for Grid View and XMLDataSource.
11. Click the debugging button to run the program.

PROPERTIES TABLE:

CONTROL PROPERTY VALUE


GridView1 DatasourceID XMLDataSource1
DataSource Personal.xml
XMLDatasource1 DataFile Personal.xml

72
PROGRAM:
Per.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>PERSONAL DETIALS</title>
</head>
<body>
<form id="form1" runat="server">
<center><h2><font color="blue">PERSONAL DETAILS USING XMLDATASOURCE
CONTROL</font></h2></center>
<div>
<asp:GridView ID="GridView1" runat="server" ForeColor="#9933FF"
DataSourceID="XmlDataSource1" AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID"
SortExpression="ID"></asp:BoundField>
<asp:BoundField DataField="NAME" HeaderText="NAME"
SortExpression="NAME"></asp:BoundField>
<asp:BoundField DataField="AGE" HeaderText="AGE"
SortExpression="AGE"></asp:BoundField>
<asp:BoundField DataField="EMAIL" HeaderText="EMAIL"
SortExpression="EMAIL"></asp:BoundField>
<asp:BoundField DataField="SALARY" HeaderText="SALARY"
SortExpression="SALARY"></asp:BoundField>
</Columns>
</asp:GridView>
<asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="~/PERS.xml"></asp:XmlDataSource>
</div>
</form>
</body>
</html>

73
Per.xml
<?xml version="1.0" encoding="utf-8" ?>
<PersonalData>
<person ID ="1" NAME ="JOHN" AGE="35" EMAIL="[email protected]"
SALARY="12000"/>
<person ID ="2" NAME ="MARY" AGE="34" EMAIL="[email protected]"
SALARY="16000"/>
<person ID ="3" NAME ="ELISA" AGE="25" EMAIL="[email protected]"
SALARY="20000"/>
<person ID ="4" NAME ="VICTOR" AGE="45" EMAIL="[email protected]"
SALARY="18000"/>
63
<person ID ="5" NAME ="EDWIN" AGE="28" EMAIL="[email protected]"
SALARY="24000"/>
<person ID ="6" NAME ="EVE" AGE="26" EMAIL="[email protected]"
SALARY="19000"/>
<person ID ="7" NAME ="QUEEN" AGE="41" EMAIL="[email protected]"
SALARY="21000"/>
</PersonalData>

74
FORM DESIGN:

OUTPUT:

RESULT:
Thus the program is implemented, executed successfully and the output is
verified.

75
EX.NO:20 DEPARTMENT WEB PAGE PAGE NO:
DATE:

AIM:
To create a Webpage for Department.
ALGORITHM:
1. Start→Microsoft Visual Studio 2022

2. Select Create a new project On the Create a new project window.


3. Select ASP.Net Web Application(.NET Framework) then click Next.
4. Enter the Project Name and Location for save the project then click Create.
5. Choose Empty Web form then click Create.
6. Rename the webform as Department and Save it.
7. Place necessary controls on the webform and set their properties.
8. Click Solution Explorer→ right click in the project name select Add→ New
Item→XML File and type the AD content and save it as Ad.xml.
9. In the toolbar choose Data→XML Data Source.

10. Set the Data properties for Ad Rotator and XMLDataSource.


11. Click Solution Explorer→ right click in project name select Add→ New
Item→Web form.
12. Rename the web form as course.aspx with Site Master1 and add the contents of
the page.
13. Repeat step 11 and create LAB.ASPX, ABOUT.ASPX web forms and the contents
of each page.
14. Choose Menu→Right Click→Properties→Navigate URL→Choose the relevant
menu’s Web form name and link it.
15. Run the DEPARTMENT.aspx web form.
16. Click the debugging button to run the program.

76
PROPERTIES TABLE:

CONTROL PROPERTY VALUE


Image1 ImageURL Logo.png
Menu1 NavigateURL Department.aspx,lab.aspx,course.aspx
Orientation Horizontal
AdRotator DataSourceID ="XmlDataSource1"
DataFile Ad.xml
XMLDatasource1 DataFile Ad.xml

PROGRAM:
Department.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DEP.aspx.cs"
Inherits="DEPARTMENT.DEP" %>

<!DOCTYPE html>
<html lang="en">

<head runat="server">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DEPARTMENT OF COMPUTER SCIENCE & BCA</title>
<style>
body {
font-family: Arial, sans-serif;
background-color:lightyellow;
color: black;
margin: 0;
padding: 0;
box-sizing: border-box;
}

header {
background-color:forestgreen;
color: blanchedalmond;
padding: 10px;
text-align: center;
}

main {
display: flex; /* Use flexbox for layout */
justify-content: space-between; /* Distribute space between columns */
padding: 20px;
}

77
.column {
width: 48%; /* Set the width of each column */
padding: 10px;
background-color: peru;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}

footer {
background-color: #333;
color: white;
padding: 10px;
text-align: center;
}
</style>
</head>
<body>
<header>
<asp:Image ID="Image1" runat="server" ImageUrl="~/IMAGES/college new
logo(1).jpg" Height="50px" />
<h1>ARUMUGHAM PALANIGURU ARTS AND SCIENCE COLLEGE FOR WOMEN</h1>
<h2>DEPARTMENT OF COMPUTER SCIENCE & BCA</h2>
</header>
<form id="form1" runat="server">
<div>
<asp:Menu ID="Menu1" runat="server" Orientation="Horizontal"
DisappearAfter="60" ForeColor="#CC00CC" Font-Bold="True" Font-Size="Large">
<Items>
<asp:MenuItem Text="HOME" Value="HOME"></asp:MenuItem>
<asp:MenuItem NavigateUrl="~/COURSES.aspx" Text="COURSES"
Value="COURSES"></asp:MenuItem>
<asp:MenuItem NavigateUrl="~/LAB.aspx" Text="LABS" Value="LAB
FACILITIES"></asp:MenuItem>
<asp:MenuItem Text="ABOUT" Value="ABOUT"></asp:MenuItem>
</Items>
</asp:Menu>
</div>
<div>
<center> <asp:AdRotator ID="AdRotator1" runat="server"
DataSourceID="XmlDataSource1" Height="300px" interval="5000" />
<asp:XmlDataSource runat="server" ID="XmlDataSource1"
DataFile="~/Ad.xml"></asp:XmlDataSource>
</center>
</div>
</form>
<main>

<div class="column">
<h2>COLLEGE</h2>
<p>Arumuga group of industries have come a long way since 1971 when it started
as a small family business and over the years, the size of the group has
drastically grown as a multifaceted business organization with a stellar
78
presence in the field of Textile, food, and education. Arumugham Palaniguru
Arts and Science College for Women is formed by Arumugham Palaniguru Charities
to provide quality education for women with top priority on women safety
protecting the cultural values with a highlight on discipline. The college is
affiliated to Madurai Kamaraj University. The college seeks to nourish the
spiritual, intellectual, physical, and aesthetic values of the students.</p>
</div>
<div class="column">
<h2>DEPARTMENT</h2>
<p>The Department of Computer Science was established in the year 2019 with
the objective of imparting quality education in the field of Computer
Science.Faculty members of the Department have specialized areas for advanced
studies and research in Software Engineering, Wireless Sensor Networks,
Computer Networks, Database and Data Mining, Cryptography, Image Processing,
Pattern Recognition, the Internet of Things, and Cloud Computing. The
Department is well equipped with state-of-the-art laboratories of all major
domains of Computer Science with excellent internet, servers, hardware, and
software support..</p>
</div>
</main>
<footer>
&copy; 2024 apccsbca.edu
</footer>
</body>
</html>
Courses.apsx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="COURSES.aspx.cs"
Inherits="DEPARTMENT.COURSES" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<font color="green" size="10">
Bachelor of Computer Science and Bachelor of Computer Applications Courses
are available.
<ol><li>B.Sc Computer Science</li>
<li>BCA</li>
</ol>
</font>
</div>
</form>
</body>
</html>

79
.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LAB.aspx.cs"
Inherits="DEPARTMENT.LAB" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<font color="blue" size="5">
The Department of Computer Science and BCA has a wide range of computing
resources and
laboratories available to support its educational and research missions.
The department has a number of high-end shared-memory
multiprocessor compute servers and file servers. Students access this
infrastructure through a
number of laboratories, including a 50-seat IT laboratory, a 40-seat CA
laboratory,
and multiple specialized research labs for individual and staffs.
</font>
</div>
</form>
</body>
</html>

80
FORM DESIGN:

OUTPUT:

81
RESULT:
Thus the program is implemented, executed successfully and the output is
verified.

82
EX.NO:21 SEND AN EMAIL PAGE NO:
DATE:

AIM:
To Write a program to Send an E-Mail.

ALGORITHM:
1. Start→Microsoft Visual Studio 2022

2. Select Create a new project On the Create a new project window.


3. Select ASP.Net Web Application(.NET Framework) then click Next.
4. Enter the Project Name and Location for save the project then click Create.
5. Choose Empty Web form then click Create.
6. Rename the webform and Save it.
7. Click Solution Explorer→ right click in project name select Add→ New
Item→Class(C#).
8. Enter the code to send mail.
9. Create an App Password in the Google for send mail.
10. Click the debugging button to run the program.

83
PROGRAM:
Mail.aspx.cs
using System;
using System.Net;
using System.Net.Mail;
using System.Threading.Tasks;
namespace SendEmailWithGoogleSMTP
{
class Program
{
static void Main(string[] args)
{
string fromMail = "[email protected]";
string fromPassword = "nwdavpkfyvgbvgyl ";

MailMessage message = new MailMessage();


message.From = new MailAddress(fromMail);
message.Subject = "Test Subject";
message.To.Add(new MailAddress("[email protected]"));
message.Body = "<html><body> Test Body </body></html>";
message.IsBodyHtml = true;

var smtpClient = new SmtpClient("smtp.gmail.com")


{
Port = 587,
Credentials = new NetworkCredential(fromMail, fromPassword),
EnableSsl = true,
};
smtpClient.Send(message);
Response.Write("Email sent successfully!");
}
}
}

84
Web.config

<?xml version="1.0" encoding="utf-8"?>


<!--
For more information on how to configure your ASP.NET application, please
visit
https://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.7.2" />
<httpRuntime targetFramework="4.7.2" />
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider,
Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4"
compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider,
Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4"
compilerOptions="/langversion:default /nowarn:41008
/define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
</compilers>
</system.codedom>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="smtpServer" value="smtp.gmail.com" />
<add key="EnableSsl" value = "true"/>
<add key="smtpPort" value="587" />
<add key="smtpUser" value="[email protected]" />
<add key="smtpPass" value="Sanju@0987" />
<add key="adminEmail" value="[email protected]" />
</appSettings>
<system.net>
<mailSettings>
<smtp from="[email protected]">
<network host="smtp.gmail.com" password="indu@87" port="587"
userName="[email protected]" enableSsl="true"/>
</smtp>
</mailSettings>
</system.net>
</configuration>

85
OUTPUT:

RESULT:
Thus the program is implemented, executed successfully and the output is
verified.

86

You might also like