Professional Documents
Culture Documents
715 - Sanket Dalvi - 1 To 5
715 - Sanket Dalvi - 1 To 5
715 - Sanket Dalvi - 1 To 5
IT
Roll No:- 715 Div:- A
PRACTICAL NO:- 1
Practical 1(A):-
Aim:- Create Application that obtains four int values from user and displays the
product.
Source Code:-
using System;
int x, y, z, p;
Console.WriteLine("Enter no1:");
x=int.Parse(Console.ReadLine());
Console.WriteLine("Enter no2:");
y=int.Parse(Console.ReadLine());
Console.WriteLine("Enter no3:");
z=int.Parse(Console.ReadLine());
Console.WriteLine("Enter no4:");
p=int.Parse(Console.ReadLine());
int q = x*y*z*p;
Console.WriteLine("Product is:");
Console.WriteLine(q);
Console.ReadLine();
Output:-
Practical 1(B):-
Source Code:-
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
</div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication5
string s = TextBox1.Text;
Output:-
Practical 1(C1):-
Source Code:-
using System;
namespace ConsoleApplication1
int f1=0,f2=1,f3,n,co;
n=int.Parse(Console.ReadLine());
co=3;
Console.WriteLine("Fibonacci Series");
Console.WriteLine(f1 + "\t" + f2 );
f3=f1+f2;
Console.Write("\t" + f3);
f1=f2;
f2=f3;
co++;
Console.ReadLine();
Output:-
Practical 1(C2):-
Source Code:-
using System;
n = int.Parse(Console.ReadLine());
m=n/2;
if(n % i == 0)
flag=1;
break;
if (flag==0)
Console.Write("Number is Prime.");
Output:-
Practical 1(C3):-
Aim:- Create Application that Reverse a number and find sum of digits of a
number.
Source Code:-
using System;
n= int.Parse(Console.ReadLine());
while(n!=0)
rem=n%10;
reverse=reverse*10+rem;
m=n%10;
sum =sum+m;
n/=10;
Output:-
Practical 1(C4):-
Source Code:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace isvowel
char[]v={'a','e','i','o','u'};
char ch;
ch =Convert.ToChar(Console.ReadLine().ToLower());
for(int i=0;i<5;i++)
if(ch==v[i])
Console.WriteLine(ch+" is Vowel");
break;
else if(i==4)
Console.ReadLine();
Output:-
Practical 1(C5):-
Source Code:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace foreachdemon
int[] ch = {1,2,3,4,5};
foreach(int c in ch)
Console.Write(c+"");
Console.ReadLine();
Output:-
PRACTICAL NO:- 2
Practical 2(A1):-
Source Code:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplicationFuncOverl
return a * b;
return a * a;
return 3.14 * a * a;
Console.ReadLine();
Output:-
Practical 2(A2):-
Source Code:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
d.Teach();
s.Learn();
s.Teach();
Console.ReadLine();
class Teacher
Console.WriteLine("Teach");
class Student:Teacher
Console.WriteLine("Learn");
Output:-
Practical 2(A2):-
Source Code:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace multilevel
obj.mode();
obj.feature();
obj.Noise();
Console.ReadLine();
Output:-
Practical 2(A2):-
Source Code:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace hierarchical
interface calc1
interface calc2
interface calc3
interface calc4
c.add(8,2);
c.sub(20,10);
c.mul(5,2);
c.div(20,10);
Console.WriteLine("Addition : "+c.result1);
Console.WriteLine("Multiplication :"+c.result3);
Console.WriteLine("Division :"+c.result4);
Console.ReadLine();
Output:-
Practical 2(A2):-
Source Code:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
class Program
g.truck();
d.truck();
d.car();
s.truck();
s.bike();
Console.ReadKey();
class grandfather
Console.WriteLine("TRUCK");
Console.WriteLine("CAR");
Console.WriteLine("BIKE");
Output:-
Practical 2(A3):-
Source Code:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
class BankAccount
public BankAccount()
bal = obj.bal;
class program
b.ShowData();
c.ShowData();
Console.ReadLine();
Output:-
Practical 2(A4):-
Aim:- Interfaces
Source Code:-
using System;
string retcode();
double amtfunc();
public Transaction()
tCode = "";
amount = 0.0;
tCode = c;
amount = a;
return amount;
return tCode;
Console.WriteLine(t1.retcode());
Console.WriteLine(t2.retcode());
Console.WriteLine(t1.amtfunc());
Console.WriteLine(t2.amtfunc());
Console.ReadLine();
Output:-
Practical 2(B1):-
Source Code:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace delegate1
class Program
printDel(100000);
printDel(200);
printDel = printMoney;
printDel(100000);
printDel(200);
Console.ReadLine();
Console.WriteLine("Number:{0}", num);
Console.WriteLine("Money:{0}", money);
Output:-
Practical 2(B2):-
Part A:-
Source Code:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication5
class program
Console.WriteLine("total{0}:{1}",studentName,studentList.Count());
Console.ReadKey();
IList<String>studentList=null;
return studentList;
Output:-
Part B:-
Source Code:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication5
class program
try
IList<String> studentList =
FindAllStudentFromDatabase(studentName);
Console.ReadKey();
IList<String>studentList=null;
return studentList;
Output:-
PRACTICAL NO:- 3
Practical 3(A1):-
Aim:- Create a simple web page with various server controls to demonstrate
setting and use of their properties. (Example : AutoPostBack)
Source Code:-
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
<asp:ListItem Value="1"></asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
<asp:ListItem>5</asp:ListItem>
</asp:DropDownList><br />
</div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace _3a2_autopostback
double P = Convert.ToDouble(TextBox1.Text);
double r = Convert.ToDouble(TextBox2.Text);
double t = Convert.ToDouble(DropDownList1.SelectedValue);
double P = Convert.ToDouble(TextBox1.Text);
double r = Convert.ToDouble(TextBox2.Text);
double t = Convert.ToDouble(DropDownList1.SelectedValue);
Output:-
Practical 3(B):-
Aim:- Demonstrate the use of Calendar control to perform the following operation.
Source Code:-
WebForm1.aspx:-
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
ondayrender="Calendar1_DayRender"
onselectionchanged="Calendar1_SelectionChanged" Width="330px">
Height="8pt" />
</asp:Calendar>
</div>
</form>
</body>
</html>
Design:-
WebUserControl1.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication24
Calendar1.Caption = "Kalnirnay";
Calendar1.FirstDayOfWeek = FirstDayOfWeek.Sunday;
Calendar1.TitleFormat = TitleFormat.Month;
Calendar1.NextPrevFormat = NextPrevFormat.ShortMonth;
e.Cell.BackColor = System.Drawing.Color.Yellow;
e.Cell.Controls.Add(lb1);
g1.ImageUrl = "youtube.png";
g1.Height = 20;
g1.Width = 20;
e.Cell.Controls.Add(g1);
Calendar1.SelectedDates.SelectRange(Calendar1.SelectedDate,
Calendar1.SelectedDate.AddDays(10));
e.Cell.Controls.Add(lbl1);
Output:-
PRACTICAL NO:- 4
Practical 4(A):-
Source Code:-
WebForm1.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
<tr>
<td>
Name
</td>
<td>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server"
ErrorMessage="Enter Name"
ControlToValidate="TextBox1"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server"
</td>
</tr>
<tr>
<td>
Roll No
</td>
<td>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2"
runat="server"
ErrorMessage="Enter no"
ControlToValidate="TextBox2"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
Age
</td>
<td>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3"
runat="server"
ErrorMessage="Enter Age"
ControlToValidate="TextBox3"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
Contact
</td>
<td>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4"
runat="server"
ErrorMessage="Enter Contact"
ControlToValidate="TextBox4"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5"
runat="server"
ErrorMessage="Enter E-mail"
ControlToValidate="TextBox5"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2"
runat="server"
ValidationExpression="\w+([-+.']\w+)@\w+([-.]\w+)\.\w+
([-.]\w+)*"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td>
Password
</td>
<td>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6"
runat="server"
ErrorMessage="Enter Password"
ControlToValidate="TextBox6"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
Re-type Password
</td>
<td>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7"
runat="server"
ErrorMessage="Re-type Password"
ControlToValidate="TextBox7"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:ValidationSummary ID="ValidationSummary1"
runat="server" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
Output:-
Practical 4(B):-
Source Code:-
Web form:-
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
</asp:XmlDataSource>
</div>
</form>
</body>
</html>
Xml file:
<Advertisements>
<Ad>
<ImageUrl>flip0.png</ImageUrl>
<NavigateUrl>http://www.1800flowers.com</NavigateUrl>
<AlternateText>
</AlternateText>
<Impressions>1</Impressions>
<Keyword>flowers</Keyword>
</Ad>
<Ad>
<ImageUrl>flip1.png</ImageUrl>
<NavigateUrl>http://www.babybouquets.com.au</NavigateUrl>
<Impressions>1</Impressions>
<Keyword>gifts</Keyword>
</Ad>
<Ad>
<ImageUrl>flip2.png</ImageUrl>
<NavigateUrl>http://www.flowers2moscow.com</NavigateUrl>
<Impressions>2</Impressions>
<Keyword>russia</Keyword>
</Ad>
</Advertisements>
Output:-
Practical 4(C):-
Source Code:-
WebForm1.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
</div>
</form>
</body>
</html>
WebUserControl1.aspx
WebUserControl1.aspx.cx
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication17
Response.Redirect("https://www.google.com/");
Output:-
PRACTICAL NO:- 5
Practical 5(A):-
Aim:- Create Web Form to Demonstrate use of Website Navigation controls and
site map.
Source Code:-
WebForm1.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
</asp:TreeView>
</div>
</form>
</body>
</html>
Page1.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
Home
</div>
</form>
</body>
</html>
Page2.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
about
</div>
</form>
</body>
</html>
Page3.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
services
</div>
</form>
</body>
</html>
Page4.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
contact
</div>
</form>
</body>
</html>
Web.sitemap
</siteMapNode>
</siteMapNode>
</siteMap>
Output:-
Practical 5(B):-
Aim:- Create a web application to demonstrate use of Master Page with applying
Styles and Themes for page beautification.
1) Open Visual Studio → File → New → Website → ASP.NET Empty Web Site
Source Code:-
</asp:Content>
<h2>This is Webform</h2>
</asp:Content>
Site1.Master
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</asp:ContentPlaceHolder>
</head>
<body>
<h1>hiiiiiiiiiiiiiiiiiiiiii</h1>
<div>
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
StyleSheet1.css
body
background-color:Yellow;
Skin1.skin
<%--
Default skin template. The following skins are provided as examples only.
duplicate SkinId's per control type are not allowed in the same theme.
</asp:GridView>
--%>
Output:-
Practical 5(C1):-
Source Code:-
WebForm1.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
</div>
</form>
</body>
</html>
WebForm1.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace prac5c
int i = 0;
if (!IsPostBack)
ViewState["Count"] = i;
i = (int)ViewState["Count"];
Label1.Text = (++i).ToString();
ViewState["Count"] = i;
Output:-
Set breakpoint at Label1 then click F11 and then clock on Button in browser.
Practical 5(C2):-
Source Code:-
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
</div>
</form>
</body>
</html>
Query1.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace query
Query2.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
</div>
</form>
</body>
</html>
Query2.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace query
if (!IsPostBack)
Label1.Text = Request.QueryString["Userid"];
Label2.Text = Request.QueryString["Name"];
Output:-
Practical 5(C3):-
Aim:- Session.
Source Code:-
A] Open Visual Studio → File → New → Website → ASP.NET Empty Web Site.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
</div>
</form>
</body>
</html>
Web.config
<?xml version="1.0"?>
<configuration>
<system.web>
</system.web>
</configuration>
<system.web>
stateConnectionString="tcpip=127.0.0.1:42424"
stateNetworkTimeout="10"
sqlConnectionString="data source=127.0.0.1;Integrated
Security=SSPI"
sqlCommandTimeout="30" allowCustomSqlDatabase="false"
</system.web>
WebForm1.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace session
Name = name;
Description = description;
Cost = cost;
if (!this.IsPostBack)
Session["Furniture1"] = piece1;
Session["Furniture2"] = piece2;
Session["Furniture3"] = piece3;
lstItems.Items.Add(piece1.Name);
lstItems.Items.Add(piece2.Name);
lstItems.Items.Add(piece3.Name);
lblSession.Text += Session.Count.ToString();
lblSession.Text += Session.IsCookieless.ToString();
lblSession.Text += Session.IsNewSession.ToString();
lblSession.Text += "<br/>Timeout(minutes):";
lblSession.Text += Session.Timeout.ToString();
if(lstItems.SelectedIndex == -1)
else
lblRecord.Text += "<br/>Manufacturer:";
lblRecord.Text += piece.Description;
Output:-