Documente Academic
Documente Profesional
Documente Cultură
NET WITH C#
Practical No.-03(1)
Aim:-Create an application that allows the user to enter a number in the textbox named
getnum. Check whether the number in the textbox getnum is palindrome or not. Print the
message accordingly in the label control named lbldisplay when the user clicks on the Button
check.
Design:-
Property Table:-
Page | 1
TYBSC.IT ASP.NET WITH C#
}
if (rev == num)
lblDisplay.Text = lblDisplay.Text + num + "is a palindrone number";
else
lblDisplay.Text = lblDisplay.Text + num + "is not a palindrone
number";
}
}
Browser Output:-
Practical No.-03(2)
Aim:-Create an application which will ask the user to input his name and a message, display
the two items concatenated in a label, and change the format of the label using radio buttons
and check boxes for selection, the user can make the label text bold, underlined or italic and
change its color. Include buttons to display the message in the label, clear the text boxes and
label, and exit.
Design:-
Page | 2
TYBSC.IT ASP.NET WITH C#
Property Table:-
CONTROL PROPERTY VALUE
Lable1 Text Enter your name:
TextBox1 ID txt1
CheckBox1 Text chkbold
CheckBox1 AutoPostBack True
CheckBox2 Text chkitalic
CheckBox2 AutoPostBack True
CheckBox3 Text chkunderline
CheckBox3 AutoPostBack True
RadioButton1 Text rbtn1
RadioButton1 GroupName Color
RadioButton1 AutoPostBack True
RadioButton2 Text rbtn2
RadioButton2 GroupName Color
RadioButton2 AutoPostBack True
RadioButton3 Text rbtn3
RadioButton3 GroupName Color
RadioButton3 AutoPostBack True
Label2 Text Enter a message:
Button1 ID Display
Button2 ID Clear
TextBox2 ID Text
Label3 Text lblmessage
Code:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
Page | 3
TYBSC.IT ASP.NET WITH C#
{
}
protected void CheckBox2_CheckedChanged(object sender, EventArgs e)
{
}
protected void btn1_Click(object sender, EventArgs e)
{
if (chkbold.Checked == true)
lblmessage.Font.Bold = true;
else
lblmessage.Font.Bold = false;
if (chkitalic.Checked == true)
lblmessage.Font.Italic = true;
else
lblmessage.Font.Italic = false;
if (chkunderline.Checked == true)
lblmessage.Font.Underline = true;
else
lblmessage.Font.Underline = false;
if (rbtn1.Checked == true)
lblmessage.ForeColor = System.Drawing.Color.Red;
else if (rbtn2.Checked == true)
lblmessage.ForeColor = System.Drawing.Color.Blue;
else if (rbtn3.Checked == true)
lblmessage.ForeColor = System.Drawing.Color.Purple;
lblmessage.Text = "name:" + txt1.Text + "<br/>" + "message:" +
txt1.Text;
}
protected void btn2_Click(object sender, EventArgs e)
{
txt1.Text = "";
txt1.Text = "";
lblmessage.Text = "";
}
}
Browser Output:-
Page | 4
TYBSC.IT ASP.NET WITH C#
Practical No.-03(3)
Aim:-List of employees is available in listbox. Write an application to add selected or all
records from listbox to textbox (assume multi-line property of textbox is true).
Design:-
Property Table:-
CONTROL PROPERTY VALUE
Button1 ID Add
ListBox1 AutoPostBack True
ListBox1 Items Jancy
ListBox1 Items Prajkata
ListBox1 Items Dona
ListBox1 Items Anchiti
ListBox1 Items Rutu
Code:-
Page | 5
TYBSC.IT ASP.NET WITH C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
Practical No.-03(4)
Aim:- Create an application that calculates the total of fat, carbohydrate and protein calories.
Allow user to enter (in textboxes) the grams of fats, carbohydrate and protein. Each gram of
fat is nine calories, whereas a gram of protein or carbohydrate is four calories. Display the
total calories for the current food item in a label. Use two other labels to display an
accumulated sum of calories and a count of the items entered. The form should have three
text boxes for the user to enter the grams for each category. Include labels next to each text
box indicating what the user is to enter. Include Buttons to calculate and to clear text boxes.
Write the code for each Button.
Page | 6
TYBSC.IT ASP.NET WITH C#
Design:-
Property Table:-
CONTROL PROPERTY VALUE
Label1 Text Fat
Label2 Text Carbohydrates
Label3 Text Proteins
TextBox1 ID TextBox1
TextBox2 ID TextBox2
TextBox3 ID TextBox3
Button1 Text Calculate
Button1 ID lbldisplay
Label4 Text Label
Code:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
Page | 7
TYBSC.IT ASP.NET WITH C#
}
}
Browser Output:-
Practical No:04
Practical No:4(1)(Program using ASP.NET Validation Controls)
Aim:- Create the application that accepts name, password ,age , email id, and user id. All
the information entry is compulsory. Password should be reconfirmed. Age should be within
21 to 30. Email id should be valid. User id should have at least a capital letter and digit as
well as length should be between 7 and 20 characters.
Design:-
Page | 8
TYBSC.IT ASP.NET WITH C#
Property Table:-
CONTROL PROPERTY VALUE
Label1 Text Name:
ID Lblname
Label2 Text Password
ID lblpassword
Label3 Text Age
ID lblage
Label4 Text Emailid
ID lblemail
Label5 Text Userid:
ID lbluser
Label6 Text Confirm password
ID lbl6
TextBox1 ID txt1
TextBox2 ID txt2
TextBox3 ID txt3
TextBox4 ID txt4
TextBox5 ID txt5
TextBox6 ID txt6
TextBox6 TextMode Password
RequiredFieldValidation Display Static
ID RequiredFieldValidation
ControlToValidate txt1
ErrorMessage *pls enter name
ForeColor Red
Text *pls enter name
NAME:MITALI CHITRE ROLLNO:16302C3005
Page | 9
TYBSC.IT ASP.NET WITH C#
RequiredFieldValidation Display Static
ID RequiredFieldValidation
ControlToValidate txt2
ErrorMessage *pls enter password
ForeColor Red
Text *pls enter password
SetFocusOnError True
CompareValidator ForeColor Red
ErrorMessage *pls enter password
ControlToCompare txt2
ControlToValidate txt6
RangeValidator ID RangeValidator2
ErrorMessage *pls enter valid age
ForeColor Red
Display Static
SetFocusOnError True
ControlToValidate txt3
MinimumValue 16
MaximumValue 60
Type Integer
RegularExpressionValidator ID RegularExpressionValidator
ErrorMessage *pls enter valid email Id
ControlToValidate txt4
ForeColor Red
ValidationExpression Internet email-address
CustomValidator ControlToValidate txt5
ID CustomValidator1
ForeColor Red
SetFocusOnError True
Display Static
ErrorMessage *pls enter user Id
Text *pls enter user Id
Button1 ID btn1
Text Submit
Button2 ID btn2
Text Clear
Code:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
Page | 10
TYBSC.IT ASP.NET WITH C#
using System.Web.UI.WebControls;
}
protected void CustomValidator1_ServerValidate(object source,
ServerValidateEventArgs args)
{
String str = args.Value;
args.IsValid = false;
if (str.Length < 7 || str.Length > 20)
{
return;
}
bool capital = false;
foreach (char ch in str)
{
if (ch >= 'A' && ch <= 'Z')
{
capital = true;
break;
}
}
if (!capital) return;
bool digit = false;
foreach (char ch in str)
{
if (ch >= '0' && ch <= '9')
{
digit = true;
break;
}
}
if (!digit) return;
args.IsValid = true;
}
protected void btn1_Click(object sender, EventArgs e)
{
Response.Write("login successful....");
}
Page | 11
TYBSC.IT ASP.NET WITH C#
protected void btn2_Click(object sender, EventArgs e)
{
}
}
Browser Output:-
Page | 12
TYBSC.IT ASP.NET WITH C#
Practical No:4(2)
Practical No:2(2)(Program using ASP.NET Navigation Controls)
Aim: Create a website for bank and include all types of navigation.
Design:-
Code:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~\" title="Bank of India" description="Online banking">
<siteMapNode url="Home.aspx" title="Home" description="Go to homepage" />
<siteMapNode url="About us.aspx" title="About us" description="About us" />
Page | 13
TYBSC.IT ASP.NET WITH C#
<siteMapNode url="Annual.aspx" title="annual" description="Annual details" />
<siteMapNode url="Monthly.aspx" title="monthly" description="Monthly details" />
<siteMapNode url="Reports.aspx" title="reports" description="Reports details" />
</siteMapNode>
</siteMapNode>
</siteMap>
Browser Output:-
Browser Output:-
Page | 14
TYBSC.IT ASP.NET WITH C#
Page | 15
TYBSC.IT ASP.NET WITH C#
Page | 16
TYBSC.IT ASP.NET WITH C#
Practical No:05(a)
AIM:-Create a web App to display all the Empname and DeptId of the employee from the Database using
SQL Source control and bind it to GridView.Database Fields are(DeptId,DeptName,EmpName,Salary).
Steps:
1. Filenewwebsiteempty websitename itok
2. Right click on website madeadd new itemsql server databasename itaddyes
3. Right click on table In server exploreradd new tableadd columnssave the table
4. Right click on table made show table dataadd values
5. Right click on websiteadd new itemwebformname it
6. Go to design view
7. Add a gridviewbelow that add sqldatasource
8. Configure sqldatasourcethen add it to the gridview
9. Go to gridview menu enable sorting
Design:-
DatabaseTable:-
Page | 17
TYBSC.IT ASP.NET WITH C#
BROWSER OUTPUT:
Page | 18
TYBSC.IT ASP.NET WITH C#
Practical No:05(b)
AIM:-Create a Login Module which adds Username and Password in the database. Username in the
database should be a primary key.
Steps2:
1. Filenewwebsiteempty websitename itok
2. Right click on website madeadd new itemsql server databasename itaddyes
3. Right click on table In server exploreradd new tableadd columnssave the table
4. Right click on table made show table dataadd values
5. Right click on websiteadd new itemwebformname it
6. Go to design viewadd form for login
7. Add sqldatasourceconfigure it
8. Write code
Design:-
Page | 19
TYBSC.IT ASP.NET WITH C#
Database Table:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default123456 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlDataSource1.InsertParameters["User"].DefaultValue = TextBox1.Text;
SqlDataSource1.InsertParameters["Password"].DefaultValue = TextBox2.Text;
SqlDataSource1.Insert();
}
}
Page | 20
TYBSC.IT ASP.NET WITH C#
Broswer Output:
Practical No:05(c)
AIM:Create a Login Module which adds Username and Password in the database. Username in the
database should be a primary key.
Steps2:
1. Filenewwebsiteempty websitename itok
2. Right click on website madeadd new itemsql server databasename itaddyes
3. Right click on table In server exploreradd new tableadd columnssave the table
4. Right click on table made show table dataadd values
5. Right click on websiteadd new itemwebformname it
6. Go to design viewadd form for login
7. Add sqldatasourceconfigure it
8. Write code
DESIGN:
Page | 21
TYBSC.IT ASP.NET WITH C#
Page | 22
TYBSC.IT ASP.NET WITH C#
CODE:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default99.aspx.cs"
Inherits="Default99" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:ConnectionString %>"
DeleteCommand="DELETE FROM [detailsofemp] WHERE [DeptId] = @DeptId"
InsertCommand="INSERT INTO [detailsofemp] ([DeptId], [DeptName],
[EmpName], [Salary]) VALUES (@DeptId, @DeptName, @EmpName, @Salary)"
SelectCommand="SELECT * FROM [detailsofemp]"
UpdateCommand="UPDATE [detailsofemp] SET [DeptName] = @DeptName,
[EmpName] = @EmpName, [Salary] = @Salary WHERE [DeptId] = @DeptId">
<DeleteParameters>
<asp:Parameter Name="DeptId" Type="Byte" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="DeptId" Type="Byte" />
<asp:Parameter Name="DeptName" Type="String" />
<asp:Parameter Name="EmpName" Type="String" />
<asp:Parameter Name="Salary" Type="Decimal" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="DeptName" Type="String" />
NAME:MITALI CHITRE ROLLNO:16302C3005
Page | 23
TYBSC.IT ASP.NET WITH C#
<asp:Parameter Name="EmpName" Type="String" />
<asp:Parameter Name="Salary" Type="Decimal" />
<asp:Parameter Name="DeptId" Type="Byte" />
</UpdateParameters>
</asp:SqlDataSource>
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="DeptId" DataSourceID="SqlDataSource1">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
<asp:BoundField DataField="DeptId" HeaderText="DeptId"
ReadOnly="True"
SortExpression="DeptId" />
<asp:BoundField DataField="DeptName" HeaderText="DeptName"
SortExpression="DeptName" />
<asp:BoundField DataField="EmpName" HeaderText="EmpName"
SortExpression="EmpName" />
<asp:BoundField DataField="Salary" HeaderText="Salary"
SortExpression="Salary" /></Columns>
</asp:GridView>
<br /> </div> </form>
</body>
</html>
BROWSER OUTPUT:
Page | 24
TYBSC.IT ASP.NET WITH C#
Practical No:06(a)
AIM: Create a web page to display the news from the table Notice(id,
news_details). Use AJAX CONTROLS.
DESIGN:
CODE:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>
</asp:ScriptManager>
<asp:Label ID="lbl1" runat="server" Text="BreakingNews"></asp:Label>
NAME:MITALI CHITRE ROLLNO:16302C3005
Page | 25
TYBSC.IT ASP.NET WITH C#
<br />
<br />
<asp:Button ID="btn" runat="server" onclick="btn_Click" Text="BreakingNews" />
</div>
</form>
</body>
</html>
SOURCE CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
BROWSER OUTPUT:
Page | 26
TYBSC.IT ASP.NET WITH C#
Practical No:06(b)
AIM: In the above website also display the feedback on the browser as work
is in progress.
DESIGN:
CODE:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
NAME:MITALI CHITRE ROLLNO:16302C3005
Page | 27
TYBSC.IT ASP.NET WITH C#
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Image ID="Image2" runat="server" Height="150px" ImageUrl="~/ajsdh.png"
Width="200px" />
<br />
<asp:Label ID="Label1" runat="ser
ver" Text="Page Showing Breaking News"></asp:Label>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="lbl1" runat="server" Text="BreakingNews"></asp:Label>
<br />
<br />
<asp:Button ID="btn" runat="server" onclick="btn_Click" Text="BreakingNews" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
<asp:Label ID="Label2" runat="server" Text="Work in Progress"></asp:Label>
</ProgressTemplate>
</asp:UpdateProgress>
<br />
</div>
</form>
</body>
</html>
SOURCE CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(5000);
}
protected void btn_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"Data
Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\TEMP.VSIT-X103-
72.001\Documents\Visual Studio
2010\WebSites\WebSite1\App_Data\Database.mdf;Integrated Security=True;User
Instance=True");
con.Open();
Page | 28
TYBSC.IT ASP.NET WITH C#
SqlCommand com = new SqlCommand("Select * from NewsVsit", con);
SqlDataReader dr = com.ExecuteReader();
while (dr.Read())
{
lbl1.Text += "<br>" + dr[1].ToString() ;
}
con.Close(); } }
BROWSER OUTPUT:
Practical No:06(c)
AIM: Create a web page to display the cricket score from the table cricket (id,
name, score).
Refresh the website automatically after every 30 seconds.
DESGIN:
CODE:
Page | 29
TYBSC.IT ASP.NET WITH C#
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Score.aspx.cs"
Inherits="Score" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<br />
<br />
<asp:Label ID="Label1" runat="server" Text="CricketScoreBoard"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Timer ID="Timer1" runat="server" Interval="350" ontick="Timer1_Tick">
</asp:Timer>
<br />
</div></form>
</body>
</html>
SOURCECODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
public partial class Score : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Timer1_Tick(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"Data
Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\TEMP.VSIT-X103-
72.001\Documents\Visual Studio
2010\WebSites\WebSite1\App_Data\Database2.mdf;Integrated Security=True;User
Instance=True");
SqlDataReader dr = null;
con.Open();
SqlCommand com = new SqlCommand("Select * from ScoreCard", con);
dr = com.ExecuteReader();
while (dr.Read())
{
Label1.Text +="<br>" +dr[0].ToString() +" "+dr[1].ToString() +" "
+dr[2].ToString();
NAME:MITALI CHITRE ROLLNO:16302C3005
Page | 30
TYBSC.IT ASP.NET WITH C#
}
con.Close();
}
}
BROWSER OUTPUT:
Practical No:07(a)
AIM:Program using Language Integrated Query.
DESIGN:
Page | 31
TYBSC.IT ASP.NET WITH C#
CODE:
student.xml
<?xml version="1.0" encoding="utf-8" ?>
<students>
<student>
<srollno>
1
</srollno>
<sname>
Mitali
</sname>
<saddress>
Dadar
</saddress>
<sfees>
10000
</sfees>
</student>
<student>
<srollno>
2
</srollno>
<sname>
Jancy
</sname>
<saddress>
Sion
</saddress>
<sfees>
10000
</sfees>
</student>
<student>
<srollno>
3
</srollno>
<sname>
Dona
NAME:MITALI CHITRE ROLLNO:16302C3005
Page | 32
TYBSC.IT ASP.NET WITH C#
</sname>
<saddress>
Vasai
</saddress>
<sfees>
10000
</sfees>
</student>
</students>
CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Xml.Linq;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
XDocument xmlDoc = XDocument.Load(HttpContext.Current.Server.MapPath("XMLFile.xml"));
var studs = from s in xmlDoc.Descendants("student")
select s;
GridView1.DataSource = studs;
GridView1.DataBind();
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
SOURCE CODE:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Page | 33
TYBSC.IT ASP.NET WITH C#
</div>
</form>
</body>
</html>
OUTPUT:
Page | 34
TYBSC.IT ASP.NET WITH C#
Practical No:07(b)
AIM:Programs using Language Intergrated Query.
DESIGN:
CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
}
SOURCE CODE:
Keep till runat=server>
Code-
using System;
using System.Collections.Generic;
Page | 35
TYBSC.IT ASP.NET WITH C#
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
OUTPUT:
Page | 36
TYBSC.IT ASP.NET WITH C#
Practical No:07(c)
AIM:Programs using Language Intergrated Query.
New website make tableadd linq to sql classes.. drag table webform.. gridvie code
on pageload
DESIGN:
Page | 37
TYBSC.IT ASP.NET WITH C#
CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Data.Linq;
using System.Data.SqlClient;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DataClassesDataContext dc = new DataClassesDataContext();
var query = from m in dc.employeetables select m;
GridView1.DataSource = query;
GridView1.DataBind();
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
OUTPUT:
Page | 38
TYBSC.IT ASP.NET WITH C#
Practical No:-08(A)
Page | 39
TYBSC.IT ASP.NET WITH C#
AIM:Create a web page to give different color effects for paragraph tags,headings tags and
complete web page using JQuery.
DESIGN:
SOURCE CODE:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs"
Inherits="Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<script type="text/javascript">
$(document).ready(function () {
$("*").css("background-color","Red");
$("h1").css("color","Blue");
$("h2").css("color","Black");
$("p").css("color","purple");
$("p#intro").css("color","green");
});
</script>
<div>
Page | 40
TYBSC.IT ASP.NET WITH C#
</asp:ScriptManager>
<h1>
This is Jquery Example.</h1>
<h2>
This is Jquery heading.</h2>
<p>
First Paragraph is about introducation.</p>
<p>
Second Paragraph having details about it.</p>
<p id="intro">
Third Paragraph is with id introducation.<br/>
</p>
</div>
</form>
</body>
</html>
OUTPUT:
Page | 41
TYBSC.IT ASP.NET WITH C#
Practical No:-08(B)
AIM:Create a web page to display hide,show,toggle,slideUp,slideDown effects for
paragraph tags,using JQuery.
DESIGN:
SOURCE CODE:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs"
Inherits="Default3" %>
Page | 42
TYBSC.IT ASP.NET WITH C#
<br />
First Paragraph.</p>
<h1>
First Heading.</h1>
</div>
</form>
</body>
</html>
OUTPUT:
Page | 43
TYBSC.IT ASP.NET WITH C#
Practical No:-08(C)
AIM:Create a web page to apply fadein,fadeout,slide toggle,toggle effects for paragraph
tags using JQuery.
DESIGN:
SOURCE CODE:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs"
Inherits="Default3" %>
Page | 44
TYBSC.IT ASP.NET WITH C#
<Scripts>
<asp:ScriptReference Path="~/Scripts/jquery-1.4.1.js" />
</Scripts>
</asp:ScriptManager>
<p>
<br />
First Paragraph.</p>
<h1>
First Heading.</h1>
</div>
</form>
</body>
</html>
OUTPUT:
Page | 45
TYBSC.IT ASP.NET WITH C#
CODE:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs"
Inherits="Default4" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Page | 46
TYBSC.IT ASP.NET WITH C#
<br /> <br />
<asp:Button ID="Button1" runat="server" Text="Submit" />
<asp:Button ID="Button2" runat="server" Text="Clear" />
</div> </form></body></html>
BROWSER OUTPUT:
DESIGN:
CODE:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default5.aspx.cs"
Inherits="Default5" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.newStyle2
{
font-family: "Arial Black";
font-size: medium;
font-weight: lighter;
font-style: normal;
font-variant: normal;
color: #FF0000;
text-decoration: underline;
} </style>
</head>
<body>
<form id="form1" runat="server">
<asp:Label ID="Label1" runat="server" CssClass="newStyle2"
NAME:MITALI CHITRE ROLLNO:16302C3005
Page | 47
TYBSC.IT ASP.NET WITH C#
Text="Welcome Messsage:"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" CssClass="newStyle2"></asp:TextBox>
</form>
</body>
</html>
BROWSER OUTPUT:
CODE:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default6.aspx.cs"
Inherits="Default6" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Page | 48
TYBSC.IT ASP.NET WITH C#
<asp:HyperLink ID="HyperLink2" runat="server"
NavigateUrl="~/baf.aspx">Baf</asp:HyperLink>
<br />
<br />
<asp:HyperLink ID="HyperLink3" runat="server"
NavigateUrl="~/bms.aspx">Bms</asp:HyperLink>
</form>
</body>
</html>
Bsc
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="bsc it.aspx.cs"
Inherits="bsc_it" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="mystyle.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div>
bsc it</div></form></body></html>
Bms
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="bms.aspx.cs" Inherits="bms" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="mystyle.css" rel="stylesheet" type="text/css" />
</head> <body>
<form id="form1" runat="server">
<div>
bms </div> </form></body></html>
Baf
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="baf.aspx.cs" Inherits="baf" %>
Page | 49
TYBSC.IT ASP.NET WITH C#
Page | 50
TYBSC.IT ASP.NET WITH C#
bsc it</h1> <h2> bms</h2> <h3>
baf</h3> </form>
</body>
</html>
BROWSER OUTPUT:
CODE:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="hyper.aspx.cs"
Inherits="hyper" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
A:Link{color:Red;}
A:Visited{color:Green;}
A:hover{color:Orange;}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Default6.aspx">Contact
Us</asp:HyperLink>
</div> </form> </body> </html>
BROWSER OUTPUT:
Page | 51
TYBSC.IT ASP.NET WITH C#
Practical No: 10
AIM: (A) For the web page created for the display OF Employee data change the authentication
mode to Windows
CODE:
<system.web>
<authentication mode=Windows>
<forms loginUrl=~/Prac8/EmployeeForm.aspx>
</authentication>
</system.web
Steps for changing the authentication mode
1. Open the website created for displaying the Employee data
2.From the solution Explorer window open the web.config file
3 .In the web.config file search the <system.web> xml tag and in <system.web> xml tag go to
authentication tag
4. Change the authentication mode to windows as given above.
AIM: (B) For the webpage created for the display of Student data change the authorization mode
so that only users who have logged in as VSIT will have the authority to aces the page
CODE:
<system.web>
<authentication>
<allow users=VSIT/>
<deny users = */>
</authentication>
</system.web>
Steps for changing the authorization
1. Open the website created for displaying the Student data
2. From the solution Explorer window open the web.config file
3. In the Web.config file search the <system.web> xml tag and in <system.web> xml tag go to
authentication tag
4. Change the coding in the tag as given above
Page | 52
TYBSC.IT ASP.NET WITH C#
AIM:- Write a console application that obtains four int values from the
user and displays the product.
CODE:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplicationsept19
{
class Program
{
static void Main(string[] args)
{
int a, b, c, d, prod;
Console.Write("Enter number 1: ");
a =Convert.ToInt32(Console.ReadLine());
Console.Write("Enter number 2: ");
b = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter number 3: ");
c= Convert.ToInt32(Console.ReadLine());
Console.Write("Enter number 4: ");
d = Convert.ToInt32(Console.ReadLine());
prod = a * b * c* d;
Console.WriteLine(a + "*" + b + "*" + c + "*" + d + "=" + prod);
}
}
}
Output:-
Page | 53
TYBSC.IT ASP.NET WITH C#
Enter number 1: 12
Enter number 2: 45
Enter number 3: 67
Enter number 4: 98
12*45*67*98=3545640
Press any key to continue . . .
AIM:- If you have two integers stored in variables var1 and var2, what
Boolean test can you perform to see if one or the other (but not both) is
greater than 10?
CODE:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplicationsept19
{
class Program
{
static void Main(string[] args)
{
int var1, var2;
Console.Write("Enter number 1: ");
var1 = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter number 2: ");
var2 = Convert.ToInt32(Console.ReadLine());
if ((var1 > 10 && var2 <= 10) || (var2 > 10 && var1 <= 10))
{
Console.WriteLine("Boolean test succedded \n Both number are not >10");
}
}
}
}
Output:-
NAME:MITALI CHITRE ROLLNO:16302C3005
Page | 54
TYBSC.IT ASP.NET WITH C#
Enter number 1: 3
Enter number 2: 15
Boolean test succedded
Both number are not >10
AIM:- Write an application that includes the logic from Exercise 1, obtains two numbers from
the user, and displays them, but rejects any input where both numbers are greater than 10 and
asks for two new numbers.
Code:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplicationsept19
{
class Program
{
static void Main(string[] args)
{
int var1, var2;
label1:
Console.Write("Enter number 1: ");
var1 = Int32.Parse(Console.ReadLine());
Console.Write("Enter number 2: ");
var2 = Convert.ToInt32(Console.ReadLine());
if ((var1 > 10 && var2 > 10) )
{
Console.WriteLine("Both No are greater than 10 are not
allowed");
goto label1;
}
else
{
Console.WriteLine("Number 1: "+var1);
Console.WriteLine("Number 2 :"+var2);
} } } }
Page | 55
TYBSC.IT ASP.NET WITH C#
Output:-
Enter number 1: 56
Enter number 2: 45
Enter number 1: 1
Enter number 2: 3
Number 1: 1
Number 2 :3
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplicationsept19
{
class Program
{
static void Main(string[] args)
{
string str1;
Console.Write("Enter string 1: ");
str1 = Console.ReadLine();
string[] words = str1.Split(' ');
foreach (var a in words)
{
Console.WriteLine("\""+a+"\"");
}
}
}
}
Output:
Page | 56
TYBSC.IT ASP.NET WITH C#
"shi"
"va"
Press any key to continue . . .
namespace ConsoleApplicationsept19
{
class Program
{
static void Main(string[] args)
{
string str;
int n;
str = args[0];
n = Convert.ToInt32(args[1]);
Console.WriteLine("strings:" + str);
Console.WriteLine("number:" + n);
Console.ReadKey();
}
}
}
Page | 57
TYBSC.IT ASP.NET WITH C#
namespace ConsoleApplicationsept19
{
class Program
{
struct Student
{
public string studid, name, cname;
public int day, month, year;
}
Page | 58
TYBSC.IT ASP.NET WITH C#
int i;
for (i = 0; i < 5; i++)
{
Console.Write("Enter Student Id:");
s[i].studid = Console.ReadLine();
Console.Write("Enter Student name : ");
s[i].name = Console.ReadLine();
Console.Write("Enter Course name : ");
s[i].cname = Console.ReadLine();
Console.Write("Enter date of birth\n Enter day(1-31):");
s[i].day = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter month(1-12):");
s[i].month = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter year:");
s[i].year = Convert.ToInt32(Console.ReadLine());
}
Console.WriteLine("\n\nStudent's List\n");
for (i = 0; i < 5; i++)
{
Console.WriteLine("\nStudent ID : " + s[i].studid);
Console.WriteLine("\nStudent name : " + s[i].name);
Console.WriteLine("\nCourse name : " + s[i].cname);
Console.WriteLine("\nDate of birth(dd-mm-yy) : " + s[i].day + "-" +
s[i].month + "-" + s[i].year);
} } } }
Output:
Enter Student Id:35
Enter day(1-31):13
Enter month(1-12):7
Enter year:1997
Enter day(1-31):30
Enter month(1-12):9
Enter year:1997
NAME:MITALI CHITRE ROLLNO:16302C3005
Page | 59
TYBSC.IT ASP.NET WITH C#
Enter Student Id:54
Enter day(1-31):20
Enter month(1-12):4
Enter year:1997
Enter day(1-31):1
Enter month(1-12):6
Enter year:1997
Enter day(1-31):25
Enter month(1-12):5
Enter year:1997
Student's List
Page | 60
TYBSC.IT ASP.NET WITH C#
Date of birth(dd-mm-yy) : 30-9-1997
namespace ConsoleApplication1
{
class Program
{
static void Main(String[] args)
{
int n1 = 0, n2 = 1, n3,n;
Console.Write("Enter a number:");
n = Convert.ToInt32(Console.ReadLine());
Console.Write("\nFibonacci series\n");
Console.Write(n1 + "\t" + n2);
for (int i = 3; i <= n; i++)
{
n3 = n2 + n1;
Console.Write("\t" + n3);
n1 = n2;
n2 = n3;
}
Console.ReadKey();
}}}
Output:
Page | 61
TYBSC.IT ASP.NET WITH C#
Enter a number:6
Fibonacci series
0 1 1 2 3 5
Practical No:1(H)
Aim: Write programs using conditional statements and loops:Prime Number
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(String[] args)
{
int n, i;
Console.Write("enter a number:");
n = Convert.ToInt32(Console.ReadLine());
for (i = 2; i < n; i++)
{
if ((n % i) == 0)
break;
}
if (i == n)
Console.WriteLine(n + "is prime");
else
Console.WriteLine(n + " is not prime");
Console.ReadKey();
}
}
}
Page | 62
TYBSC.IT ASP.NET WITH C#
Output:
enter a number:3
3is prime
Practical No:02(1)
AIM: Write a program to declare a class staff having data members as name
andpost.accept this data 5for 5 staffs and display names of staff who are HOD.
CODE:
using System;
namespace staff
class staff
name = Console.ReadLine();
post = Console.ReadLine();
Page | 63
TYBSC.IT ASP.NET WITH C#
Console.WriteLine(name + "\t\t" + post);
return post;
} }
class program {
int i;
objStaff[i].getdata(); }
if (objStaff[i].getPost() == "HOD")
objStaff[i].display();
}}}}
OUTPUT:
HOD
PM
HOD
Page | 64
TYBSC.IT ASP.NET WITH C#
PM
CA
Name Post
Prachit HOD
Aniket HOD
CODE:
using System;
namespace distanceclass
class Distance
int dist1,dist2,dist3;
this.dist1=dist1;
this.dist2=dist2;
{
NAME:MITALI CHITRE ROLLNO:16302C3005
Page | 65
TYBSC.IT ASP.NET WITH C#
dist3=dist1+dist2;
Console.WriteLine("Distance1:"+ dist1);
Console.WriteLine("Distance1:"+ dist2);
Console.WriteLine("Distance1:"+ dist3);
}}
class program
objDistance.addition();
objDistance.display();
}}}
OUTPUT:
Distance1:10
Distance1:20
Distance1:30
Page | 66
TYBSC.IT ASP.NET WITH C#
CODE:
using System;
namespace swap
class Overloading
int t;
t = n;
n = m;
m = t;
Page | 67
TYBSC.IT ASP.NET WITH C#
public void swap(ref float f1, ref float f2)
float f;
f = f1;
f1 = f2;
f2 = f;
class program
}}}
OR
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace swap
{
class Overloading
{
NAME:MITALI CHITRE ROLLNO:16302C3005
Page | 68
TYBSC.IT ASP.NET WITH C#
public void swap(ref int n, ref int m)
{
int t;
t = n;
n = m;
m = t;
}
public void swap(ref float f1, ref float f2)
{
float f;
f = f1;
f1 = f2;
f2 = f;
}
}
class program
{
static void Main(string[] args)
{
Overloading obj = new Overloading();
int n, m;
float f1, f2;
}
}
}
OUTPUT:
N=20 M=10
F1=20.6 F2=10.5
Page | 69
TYBSC.IT ASP.NET WITH C#
CODE:
Furniture.cs
using System;
namespace SingleInheritance
class Furniture
string material;
float price;
Page | 70
TYBSC.IT ASP.NET WITH C#
Console.Write("Enter material : ");
material = Console.ReadLine();
price = float.Parse(Console.ReadLine());
}}}
Table.cs
using System;
namespace SingleInheritance
class Table:Furniture
base.getdata();
height = int.Parse(Console.ReadLine());
Class Furniture
Page | 71
TYBSC.IT ASP.NET WITH C#
Class Table
surface_area = int.Parse(Console.ReadLine());
base.showdata();
}}}
Program.cs
using System;
namespace SingleInheritance
class Program
t1.getdata();
t1.showdata();
}}}
Or
using System;
using System.Collections.Generic;
NAME:MITALI CHITRE ROLLNO:16302C3005
Page | 72
TYBSC.IT ASP.NET WITH C#
using System.Linq;
using System.Text;
namespace swap
{
class Furniture
{
string material;
float price;
public void getData()
{
Console.Write("enter the type of material");
material = Console.ReadLine();
Console.Write("enter price:");
price = float.Parse(Console.ReadLine());
}
public void showData()
{
Console.Write("material: " + material);
Console.Write("price: " + price);
}
}
class Table:Furniture
{
float height, surface_area;
public void getData()
{
base.getData();
Console.Write("enter the type of height");
height = float.Parse(Console.ReadLine());
Console.Write("enter surface area:");
surface_area = float.Parse(Console.ReadLine());
}
public void showData()
{
base.showData();
Console.Write("height: " + height);
Console.Write("surface area: " + surface_area);
class program
{
static void Main(string[] args)
{
Table t = new Table();
t.getData();
t.showData();
Console.Read();
Page | 73
TYBSC.IT ASP.NET WITH C#
}
}
}
OUTPUT:
Enter height: 35
Material : wood
Price : 1220
Height : 35
Surface Area : 26
CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication4
{
class Salary
{
NAME:MITALI CHITRE ROLLNO:16302C3005
Page | 74
TYBSC.IT ASP.NET WITH C#
int basic, ta, da, hra;
public Salary()
{
da = 9000;
hra = 6000;
}
public void getdata()
{
Console.Write("Enter basic salary : ");
basic = int.Parse(Console.ReadLine());
Console.Write("Enter travelling allowance : ");
ta = int.Parse(Console.ReadLine());
}
public void showdata()
{
Console.WriteLine("Basic salary : " + basic);
Console.WriteLine("Dearness allowence : " + da);
Console.WriteLine("Housing rent allowence : " + hra);
Console.WriteLine("Travelling allowence : " + ta);
Console.WriteLine("Gross Salary : " + (basic + da + hra + ta));
} }
class Program
{
static void Main(string[] args)
{
Salary s = new Salary();
s.getdata();
s.showdata();
Console.Read();
}
}
}
OUTPUT:
Page | 75
TYBSC.IT ASP.NET WITH C#
CODE:
Gross.cs
using System;
namespace MultipleInheritance
interface Gross
int ta
get;
set;
int da
get;
set;
int GrossSal();
}}
Employee.cs
using System;
namespace MultipleInheritance
class Employee
Page | 76
TYBSC.IT ASP.NET WITH C#
string name;
{ this.name = name; }
{ return basicSal; }
}}}
Salary.cs
Interface: Gross
TA,DA ,Gross_sal()
Class : Employee
name, basic_sal()
Class : salary
Disp_sal(),HRA
using System;
namespace MultipleInheritance
class Salary:employee,Gross
int hra;
Page | 77
TYBSC.IT ASP.NET WITH C#
public Salary(string name, int hra):base(name)
{ this.hra = hra; }
public int ta
public int da
int gSal;
return gSal;
{ base.ShowData();
}}}
Program.cs
using System;
Page | 78
TYBSC.IT ASP.NET WITH C#
namespace MultipleInheritance
class Program
s.da = 20000;
s.ta = 30000;
s.dispSal();
}}}
OUTPUT:
Name :Prachit
Page | 79
TYBSC.IT ASP.NET WITH C#
AIM: Write a program for above class hierarchy for the Employee where the base class
is Employee and derived class and Programmer and Manager. Here make display
function virtual which is common for all and which will display information of
Programmer and Manager interactively.
CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;
namespace HeirarchicalInheritance
{
class employee
{
public virtual void display()
{
Console.WriteLine("Display of employee class called ");
}
}
class Programmer : employee
{
public void display()
{
Console.WriteLine(" Display of Programmer class called ");
}
}
Page | 80
TYBSC.IT ASP.NET WITH C#
else
{
Console.WriteLine("Wrong choice entered");
}
Console.Read();
}
}
}
OUTPUT:
1.Programmer
2.Manager1
1.Programmer
2.Manager2
1.Programmer
2.Manager6
CODE:
Result.cs
using System;
namespace multilevelinheritance
Page | 81
TYBSC.IT ASP.NET WITH C#
{
class Result:Test
int total;
base.display();
}}}
Test.cs
using System;
namespace multilevelinheritance
class Test:student
: base(roll_no, name)
this.marks1 = marks1;
Page | 82
TYBSC.IT ASP.NET WITH C#
this.marks2 = marks2;
Class student
Class Test
Class Result
return marks1;
return marks2;
base.display();
}}}
Student.cs
using System;
Page | 83
TYBSC.IT ASP.NET WITH C#
namespace multilevelinheritance
class student
int roll_no;
string name;
this.roll_no = roll_no;
this.name = name;
public student() { }
}}}
Program.cs
using System;
namespace multilevelinheritance
class Program
Page | 84
TYBSC.IT ASP.NET WITH C#
{
r1.display();
}}}
OUTPUT:
Name: Prachit
Marks1: 50
Marks2: 70
Total: 120
Page | 85
TYBSC.IT ASP.NET WITH C#
Public static void Green()
CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication3
{
public delegate void TrafficDel();
class TrafficSignal
{
public static void Yellow()
{
Console.WriteLine("Yellow light signals to get ready");
}
public static void Green()
{
Console.WriteLine("Green light signals to go");
}
public static void Red()
{
Console.WriteLine("Red light signals to stop");
}
TrafficDel[] td = new TrafficDel[3];
public void IdentifySignal()
{
td[0] = new TrafficDel(Yellow);
td[1] = new TrafficDel(Green);
td[2] = new TrafficDel(Red);
}
public void display()
{
td[0]();
td[1]();
Page | 86
TYBSC.IT ASP.NET WITH C#
td[2]();
}
}
class Program
{
static void Main(string[] args)
{
TrafficSignal ts = new TrafficSignal();
ts.IdentifySignal();
ts.display();
Console.Read();
} } }
OUTPUT:
CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Page | 87
TYBSC.IT ASP.NET WITH C#
namespace ConsoleApplication3
{
class NotEvenException:Exception
{
public NotEvenException(string msg)
: base(msg)
{
}
}
class Program
{
static void Main(string[] args)
{
int num;
try
{
Console.Write("Enter a number: ");
num = int.Parse(Console.ReadLine());
if ((num % 2) != 0) throw new NotEvenException("Not an even number ");
else
Console.WriteLine("Its even number ");
}
catch (NotEvenException e) { Console.WriteLine(e.Message); }
Console.Read();
} } }
OUTPUT:
Enter a number: 5
Enter a number: 6
Page | 88