Professional Documents
Culture Documents
Aim: Write an 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.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
}
protected void btn_Product_Click(object sender, EventArgs e)
{
int a, b, c, d, p;
a = Convert.ToInt32(TextBox1.Text);
b = Convert.ToInt32(TextBox2.Text);
c = Convert.ToInt32(TextBox3.Text);
d = Convert.ToInt32(TextBox4.Text);
p = a * b * c * d;
TextBox5.Text = Convert.ToString(p);
}
}
Output:
PRACTICAL NO 1(b)
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
}
protected void Button1_Click(object sender, EventArgs e)
{
string str1;
str1 = TextBox1.Text;
string[] words = str1.Split(' ');
for(int i=0;i<words.Length;i++)
{
TextBox2.Text = TextBox2.Text + words[i]+"\r\n";
}
}
}
Output:
PRACTICAL NO: 01(C)
AIM: Write an application that receives the following information from a set of
students: (Student Id, Student Name, Course Name, Date of Birth). The application
should also display the information of all the students once the data is entered.
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sree1
{
class Program
{
struct Student
{
public string studid, name, cname;
public int day, month, year;
}
static void Main(string[] args)
{
Student[] s = new Student[5];
int i;
for (i = 0; i < 3; 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 < 3; 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);
}
Console.ReadLine();
}
}
}
Output:
PRACTICAL NO. : 01(D)
Aim: Create application to demonstrate the following operations
i) Fibonacci series
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
}
protected void Button1_Click(object sender, EventArgs e)
{
int f1 = 0, f2 = 1, f3, n, co;
n = int.Parse(TextBox1.Text);
co = 3;
Response.Write("Fibonaaci Series:");
Response.Write(f1 + "\t" + f2);
while (co <= n)
{
f3 = f1 + f2;
Response.Write("\t" + f3);
f1 = f2;
f2 = f3;
co++;
}
}
}
Output
PRACTICAL NO. : 01(D)
Aim: Create application to demonstrate the following operations
ii) Test for prime numbers
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
}
}
Output:
PRACTICAL NO. : 01(D)
Aim: Create application to demonstrate the following operations
iii) Test for vowels
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
}
protected void Button1_Click(object sender, EventArgs e)
{
string ch;
int count = 0;
ch = TextBox1.Text;
for (int i = 0; i < ch.Length; i++)
{
if((ch.Substring(i,1)=="a")||(ch.Substring(i,1)=="e")||(ch.Substring(i,1)=="i")||(ch.Subst
ring(i,1)=="o")||(ch.Substring(i,1)=="u"))
{
count++;
}
}
Response.Write("Given String:"+ch);
Response.Write("Total Number of Vowels:"+count);
}
}
Output:
PRACTICAL NO. : 01(D)
Aim: Create application to demonstrate the following operations
iv) using foreach loop with arrays
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
}
protected void Button1_Click(object sender, EventArgs e)
{
int[] a = { 1, 2, 3, 4 };
foreach (int x in a)
Response.Write(x);
}
}
Output:
PRACTICAL NO. : 01(D)
Aim: Create application to demonstrate the following operations
v) Reverse a number and find the sum of digits of the number
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
}
protected void Button1_Click(object sender, EventArgs e)
{
int n, m, r = 0, d, sum = 0;
n = int.Parse(TextBox1.Text);
m = n;
while (n > 0)
{
d = n % 10;
r = r * 10 + d;
sum = sum + d;
n = n / 10;
}
Response.Write("Reverse of" + m + "=" + r + "<br>");
Response.Write("Sum of its digits:" + sum);
}
}
Output:
PRACTICAL NO: 2 (a)
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace functionoverloading
{
class Shape
{
public void Area(int side)
{
int squarearea = side * side;
Console.WriteLine("The Area of Square is :" + squarearea);
}
public void Area(int length, int breadth)
{
Output:
PRACTICAL NO: 2(b)
Single Inheritance
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication20
{
class Program
{
static void Main(string[] args)
{
Teacher d = new Teacher();
d.Teach();
s.Learn();
s.Teach();
Console.ReadKey();
}
class Teacher
{
}
}
Console.WriteLine("Learn");
}
}
}
}
Output:
PRACTICAL NO: 2(c)
Hierarchial Inheritance
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication20
{
class Program
{
static void Main(string[] args)
{
Principal g = new Principal();
g.Monitor();
d.Monitor();
d.Teach();
s.Monitor();
s.Learn();
Console.ReadKey();
}
class Principal
{
Console.WriteLine("Monitor");
Console.WriteLine("Teach");
}
class Student : Principal
{
Console.WriteLine("Learn");
}
}
}
Output:
PRACTICAL NO: 2(d)
Multilevel Inheritance
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication20
{
class inheri : vehicle
obj.mode();
obj.feature();
obj.Noise();
Console.Read();
}
}
class Mode
Output:
PRACTICAL NO: 2(e)
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication20
{
class GameScore
{
string user;
int age;
//Default Constructor
public GameScore()
{
user = "Steven";
age = 28;
Console.WriteLine("Previous User {0} and he was {1} year old", user, age);
}
//Parameterized Constructor
public GameScore(string name, int age1)
{
user = name;
age = age1;
Console.WriteLine("Current User {0} and he is {1} year old", user, age);
}
}
class Program
{
static void Main(string[] args)
{
GameScore gs = new GameScore(); //Default Constructor Called
GameScore gs1 = new GameScore("Clark", 35); //Overloaded Constructor.
Console.ReadLine();
}
}
Output:
PRACTICAL NO: 2(f)
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication20
{
public interface ITransactions
{
void showTransaction();
double getamnt();
public Transaction()
{
amnt = 0.0;
Code = c;
date = d;
amnt = a;
return amnt;
}
public void showTransaction()
{
class example
{
t1.showTransaction();
t2.showTransaction();
Console.ReadKey();
Output:
PRACTICAL NO: 2(g)
Aim: Create simple application to demonstrate the use of delegates and events.
Delegates
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication20
{
public class TestDelegate
{
//Declaration
//Creating Delegates with no parameters and no return type.
public delegate void FirstDelegate();
class Program
{
static void Main(string[] args)
{
TestDelegate testdelegate = new TestDelegate();
//Instantiation
TestDelegate.FirstDelegate fd1 = new TestDelegate.FirstDelegate(testdelegate.fun1);
TestDelegate.FirstDelegate fd2 = new TestDelegate.FirstDelegate(testdelegate.fun2);
TestDelegate.FirstDelegate fd3 = new TestDelegate.FirstDelegate(testdelegate.fun3);
//Invocation
fd1();
fd2();
fd3();
Console.ReadKey();
}
}
}
Output:
PRACTICAL NO: 2(h)
Aim: Create simple application to demonstrate the use of delegates and events.
Events
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication20
{
class Program
{
static void Main(string[] args)
{
AddTwoNumbers a = new AddTwoNumbers();
//Event gets binded with delegates
a.ev_OddNumber += new AddTwoNumbers.dg_OddNumber(EventMessage);
a.Add();
Console.Read();
}
//Delegates calls this method when event raised.
static void EventMessage()
{
Console.WriteLine("********Event Executed : This is Odd Number**********");
}
}
//This is Publisher Class
class AddTwoNumbers
{
public delegate void dg_OddNumber(); //Declared Delegate
public event dg_OddNumber ev_OddNumber; //Declared Events
Output:
PRACTICAL NO: 2(i)
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication20
{
class ExceptionTest
{
static double SafeDivision(double x, double y)
{
if (y == 0)
throw new System.DivideByZeroException();
return x / y;
}
static void Main()
{
// Input for test purposes. Change the values to see
// exception handling behavior.
double a = 98, b = 0;
double result = 0;
try
{
result = SafeDivision(a, b);
Console.WriteLine("{0} divided by {1} = {2}", a, b, result);
}
catch (DivideByZeroException e)
{
Console.WriteLine("Attempted divide by zero.");
}
Console.ReadLine();
}
}
Output:
PRACTICAL NO: 3 (A)
Aim: Create a simple web page with various server control to demonstrate setting and use of
their properties.
Code:
Server.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
Server.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
string s;
if (rdbfy.Checked == true)
{
s = rdbfy.Text;
}
else if (rdbsy.Checked == true)
{
s = rdbsy.Text;
}
else
{
s = rdbty.Text;
Label5.Text += ("in "+s);
}
}
}
Output:
PRACTICAL NO: 3 (B)
Aim: Demonstrate the use of Calendar Control to perform the following operations.
Code:
Calendar.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
Calendar.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
}
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
if (e.Day.Date.Day == 15)
e.Cell.Controls.Add(new LiteralControl("<br/> Holiday"));
}
}
Output:
PRACTICAL NO: 3 (B)
Aim: Demonstrate the use of Calendar Control to perform the following operations.
Code:
Vacation.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
Vacation.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
}
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
if (e.Day.Date.Day == 5 && e.Day.Date.Month == 9)
{
e.Cell.BackColor = System.Drawing.Color.Yellow;
Label lbl = new Label();
lbl.Text = "<br>Teachers Day!";
e.Cell.Controls.Add(lbl);
Image g1 = new Image();
g1.ImageUrl = "td.jpg";
g1.Height = 20;
g1.Width = 20;
e.Cell.Controls.Add(g1);
}
if (e.Day.Date.Day == 13 && e.Day.Date.Month == 9)
{
Calendar1.SelectedDate = new DateTime(2018, 9, 12);
Calendar1.SelectedDates.SelectRange(Calendar1.SelectedDate,
Calendar1.SelectedDate.AddDays(10));
Label lbl1 = new Label();
lbl1.Text = "<br>Ganpati!";
e.Cell.Controls.Add(lbl1);
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Calendar1.Caption = "SAMBARE";
Calendar1.FirstDayOfWeek = FirstDayOfWeek.Sunday;
Calendar1.NextPrevFormat = NextPrevFormat.ShortMonth;
Calendar1.TitleFormat = TitleFormat.Month;
Label2.Text = "Todays Date"+Calendar1.TodaysDate.ToShortDateString();
Label3.Text = "Ganpati Vacation Start: 9-13-2018";
TimeSpan d = new DateTime(2018, 9, 13) - DateTime.Now;
Label4.Text = "Days Remaining For Ganpati Vacation:"+d.Days.ToString();
TimeSpan d1 = new DateTime(2018, 12, 31) - DateTime.Now;
Label5.Text = "Days Remaining for New Year:"+d1.Days.ToString();
if (Calendar1.SelectedDate.ToShortDateString() == "9-13-2018")
Label3.Text = "<b>Ganpati Festival Start</b>";
if (Calendar1.SelectedDate.ToShortDateString() == "9-23-2018")
Label3.Text = "<b>Ganpati Festival End</b>";
}
protected void Button2_Click(object sender, EventArgs e)
{
Label1.Text = "";
Label2.Text = "";
Label3.Text = "";
Label4.Text = "";
Label5.Text = "";
Calendar1.SelectedDates.Clear();
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
Label1.Text = "Your Selected Date:" + Calendar1.SelectedDate.Date.ToString();
}
}
Output:
PRACTICAL NO: 3 (B)
Aim: Demonstrate the use of Calendar Control to perform the following operations.
Code:
Selectedday.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
Selectedday.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
}
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
if (e.Day.Date >= new DateTime(2018, 9, 9) && e.Day.Date <= new DateTime(2018, 9,
18))
{
e.Cell.BackColor = System.Drawing.Color.Aquamarine;
e.Cell.BorderColor = System.Drawing.Color.Black;
e.Cell.BorderWidth = new Unit(3);
}
if (e.Day.IsOtherMonth)
{
e.Cell.Controls.Clear();
}
}
}
Output:
PRACTICAL NO: 3 (B)
Aim: Demonstrate the use of Calendar Control to perform the following operations.
Code:
Datesdiff.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
Datesdiff.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
}
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
if (e.Day.Date >= new DateTime(2018,11,23) && (e.Day.Date <= new
DateTime(2018,11,30)))
{
e.Cell.BackColor = System.Drawing.Color.BlueViolet;
e.Cell.BorderColor = System.Drawing.Color.Black;
e.Cell.BorderWidth = new Unit(3);
}
}
protected void Button1_Click(object sender, EventArgs e)
{
TimeSpan t = Calendar2.SelectedDate - Calendar1.SelectedDate;
Label1.Text = t.Days.ToString();
}
}
Output:
PRACTICAL NO 3(c)
Aim: Demonstrate the use of Tree view control to perform the following
operations.
Code:
Stdetail.xml
Navigation.aspx
<!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" ImageSet="Arrows">
<HoverNodeStyle Font-Underline="True" ForeColor="Maroon" />
<Nodes>
<asp:TreeNode Text="File" Value="File">
<asp:TreeNode Text="Date" Value="Date">
<asp:TreeNode NavigateUrl="~/Calander.aspx" Text="Calander"
Value="Calander"></asp:TreeNode>
</asp:TreeNode>
<asp:TreeNode Text="PageTwo" Value="PageTwo">
<asp:TreeNode NavigateUrl="~/Welcome.aspx" Text="Welcome"
Value="Welcome"></asp:TreeNode>
</asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
<br />
Fetch Datalist Using XML data :
<asp:DataList ID="DataList1" runat="server">
<ItemTemplate>
<table class = "table" border="1">
<tr>
<td>Roll Num : <%# Eval("sid") %><br />
Name : <%# Eval("sname") %><br />
Class : <%# Eval("sclass")%>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</div>
</form>
</body>
</html>
Navigation.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.Data;
Output:
PRACTICAL NO 3(c)
Aim: Demonstrate the use of Tree view control to perform the following
operations.
Code:
Navigation.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
Navigation.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
}
protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
{
Response.Write("You have selected the option:" + TreeView1.SelectedValue);
}
Output
Practical No : 4(a)
Code:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
Output:
Practical No : 4(b)
Code:
adds.xml
Addrotator.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
Output:
PRACTICAL NO : 4(C)
Code:
MyUserControl.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MyUserControl.ascx.cs"
Inherits="MyUserControl" %>
<h3>This is User Contro1 </h3>
<table>
<tr>
<td>Name</td>
<td>
<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>City</td>
<td><asp:TextBox ID="txtcity" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td></td>
<td>
</td>
</tr>
<tr>
<td></td>
<td>
<asp:Button ID="txtSave" runat="server" Text="Save" onclick="txtSave_Click" />
</td>
</tr>
</table>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<br />
MyUserControl.ascx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
}
protected void txtSave_Click(object sender, EventArgs e)
{
Label1.Text = "Your Name is " + txtName.Text + " and you are from " +txtcity.Text;
}
}
WebC.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<uc:Student ID="studentcontrol" runat="server" />
</div>
</form>
</body>
</html>
Output:
PRACTICAL NO: 5(a)
Aim: Create web form to demonstrate use of website navigation controls and
sitemap
Code:
Home.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:SiteMapPath ID="SiteMapPath1" runat="server" EnableTheming="false">
</asp:SiteMapPath>
<div>
</div>
</form>
</body>
Second.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:SiteMapPath ID="SiteMapPath1" runat="server"
EnableTheming="false"></asp:SiteMapPath>
<br /> Welcome to online store
</div>
</form>
</body>
</html>
Third.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:SiteMapPath ID="SiteMapPath1" runat="server"
EnableTheming="false"></asp:SiteMapPath>
<br /> Hello welcome to the mobile shopping page...
</div>
</form>
</body>
</html>
Web.sitemap
Output:
Practical 5(b)
Aim: Create a web application to demonstrate use of Master Page with applying
Styles and Themes for page beautification.
Code:
Masterpage.master
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<link rel="Stylesheet" href="StyleSheet.css" type="text/css" />
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
<p>
</p>
<p>
</p>
<p>
</p>
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
Page2.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="Page2.aspx.cs" Inherits="Page2"
Theme="Theme" %>
Page3.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="Page3.aspx.cs" Inherits="Page3" %>
Stylesheet.css
body {
background-color:blueviolet;
font:italic;
font-family: Cambria;
}
Theme.skin
<%--
Default skin template. The following skins are provided as examples only.
Output:
PRACTICAL 6 (a)
Aim: Create a web application to bind data in a multiline textbox by querying in
another textbox.
Code:
1. Create a webpage with one Button, one Multiline TextBox and one list box with
setting TextMode Property of text box to Multiline
2. Write the Database related code in code behind C# file
Web.confing
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
</system.web>
<connectionStrings>
<add name="connStr" connectionString="Data
Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename='C:\Users\tushars\Documents\Visual
Studio2015\WebSites\Workshop\App_Data\Database.mdf';Integrated Security=True" />
</connectionStrings>
</configuration>
Code:
Default.aspx.cs
Output:
PRACTICAL NO 7(a)
Aim: Create Web application to display data binding using dropdown list control.
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;
Output
PRACTICAL NO 7(b)
Aim: Create a web application to display the phone number of an author using
database
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;
}
}
Output:
PRACTICAL NO 8
Aim: Create a web application to demonstrate data binding using Details view
Code:
Details View
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
Output
PRACTICAL NO 9
Aim: Create a web application to demonstrate data binding using Form view
Code:
Form View
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:collegeConnectionString %>"
SelectCommand="SELECT * FROM [bookdet]"></asp:SqlDataSource>
</div>
</form>
</body>
</html>
Output
PRACTICAL NO 10 (A)
Aim: Create a web application to demonstrate reading and writing operation with xml.
Code:
XmlFile2.xml
Default.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;
}
protected void Button1_Click(object sender, EventArgs e)
{
XmlReader read = XmlReader.Create(@"D:\Database example2\XMLFile2.xml");
while (read.Read())
{
if (read.NodeType.Equals(XmlNodeType.Element))
{
string s = Label1.Text + " ";
Label1.Text = s + read.Name;
}
}
read.Close();
}
protected void Button2_Click(object sender, EventArgs e)
{
XmlWriterSettings set = new XmlWriterSettings();
set.Indent = true;
XmlWriter wr = XmlWriter.Create(@"D:\Database example2\XMLFile.xml",set);
wr.WriteStartDocument();
wr.WriteComment("example of write to xml document");
wr.WriteStartElement("student");
wr.WriteEndElement();
}
}
Output:
PRACTICAL NO 10(c)
Aim: Create a web application to demonstrate the use of various AJAX controls.
Code:
Default.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
Output:
Practical No: 11
Library file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ClassLibrary1
{
public class Class1
{
public int add(int a, int b)
{
int c = a + b;
return c;
}
}
}
Console
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ClassLibrary1;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
ClassLibrary1.Class1 c = new Class1();
int t = c.add(1, 2);
Console.WriteLine("addition ={0}", t);
Console.ReadKey();
}
}
}
Output: