0% found this document useful (0 votes)
70 views

8423 AWP Practical File

The document details the practical work completed by a student named Abhay Daundkar for their Advanced Web Programming course. It includes 9 sections covering different concepts taught like C#, ASP.NET, AngularJS and demonstrated through various programs and applications developed by the student.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views

8423 AWP Practical File

The document details the practical work completed by a student named Abhay Daundkar for their Advanced Web Programming course. It includes 9 sections covering different concepts taught like C#, ASP.NET, AngularJS and demonstrated through various programs and applications developed by the student.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 93

Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Certificate

This is to certify that Mr. /Miss. Abhay.S.Daundkar Examination Seat no.8423 has

successfully completed all the practicals of the subject Advanced Web Programming

in partial fulfillment for the degree of B.Sc. (Information Technology) SEM V,

affiliated to university of Mumbai for the academic year 2022-2023.

Internal Examiner

Head of the Department External Examiner


Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Sr Details Date Sign


No.

1 Working with basic C# and ASP .NET  23-06-


22
a. Create an application that obtains four int values from the user
and displays the product. 
b. Create an application to demonstrate string operations 
c. Programs to create and use DLL 
d. Create an application to demonstrate following operations 
    i. Generate Fibonacci series. 
    ii. Test for prime numbers. 
    iii. Test for vowels. 
    iv. Use of foreach loop with arrays 
    v. Reverse a number and find the sum of digits of a number

2 Create a simple application to demonstrate use of following 30-06-


concepts  22
i. Function Overloading 
ii. Inheritance (all types) 
iii. Constructor overloading 
iv. Interfaces 
v. Using Delegates and events 
vi. Exception handling

d3 a. Create a simple web page with various server controls to 07-07-


demonstrate setting and use of 22
their properties. (Example: AutoPostBack) 
b. Demonstrate the use of Calendar control to perform following
operations. 
     i. Display messages in a calendar control 
     ii. Display vacation in a calendar control 
     iii. Selected day in a calendar control using style

4 Working with Form Controls  14-07-


22
a. Create a Registration form to demonstrate use of various
Validation controls. 
b. Create Web Form to demonstrate use of Ad rotator Control

5 Working with Navigation, Beautification and Master page.  11-08-


22
a. Create Web Form to demonstrate use of Website Navigation
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

controls and Site Map. 


b. Create a web application to demonstrate the use of Master Page
with applying Styles and
Themes for page beautification. 

6 Working with Database (Connected Data Access) 18-08-


Write a web application to perform CRUD operation. 22

7 Create a web application to display Using Disconnected Data 25-08-


Access and Data Binding using Grid View. 22

8 Working with GridView control : 01-09-


 Create a web application to demonstrate use of GridView button 22
column and GridView events.

9 Write a program to demonstrate the concept of directives in 15-09-


AngularJS. 22
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

PRACTICAL-1
1A] Create an application that obtains four int values from the user and
displays the product.
Code:
using System;
public class Practical1
{
public static void Main()
{
Console.WriteLine("Enter First Int: ");
int a = int.Parse(Console.ReadLine());
Console.WriteLine("Enter Second Int: ");
int b = int.Parse(Console.ReadLine());
Console.WriteLine("Enter Third Int: ");
int c = int.Parse(Console.ReadLine());
Console.WriteLine("Enter Fourth Int: ");
int d = int.Parse(Console.ReadLine());
Console.WriteLine("The product of four integers: " + a * b * c * d);
int e = int.Parse(Console.ReadLine());
}
}

OUTPUT :

1B] Create an application to demonstrate string operations.


Code:
using System;
public class practical2b
{
public static void Main(string[] args)
{
string Name;
Name = "Abhay Daundkar";
string id;
id = "8423";
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

string Subject;
Subject = "Awp";
string marks;
marks = "100";
string rank = "1";
Console.WriteLine("Name: " + Name);
Console.ReadLine();
Console.WriteLine("id: " + id);
Console.ReadLine();
Console.WriteLine("Subject: " + Subject);
Console.ReadLine();
Console.WriteLine("Marks: " + marks);
Console.ReadLine();
Console.WriteLine("Rank: " + rank);
Console.ReadLine();
}
}

Output:

1C] Programs to create and use DLL.


1. Creating a DLL File:
1. Open Visual Studio then select "File" -> "New" -> "Project..." then select
"Visual C#" -> "Class library".
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

2. In the calculate class, write methods for the addition and subtraction of
two integers.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Calculation
{
public class Calculate
{
public int Add(int a, int b)
{
return a + b;
}
public int Sub(int a, int b)
{
return a - b;
}
}
}
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

1. Using DLL File


Step 1 – Create "Windows Forms application"

Step 2 - Design the form


Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Step 3 - Add a reference for the dll file, "calculation.dll", that we created
earlier.
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Right- click on the project and then click on "Add reference".

Step 4 - Add the namespace ("using calculation;") and write the code.
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

using Calculation;
namespace FORM1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Calculate cal = new Calculate();
private void button1_Click(object sender, EventArgs e)
{
try
{
int i = cal.Add(int.Parse(textBox1.Text), int.Parse(textBox2.Text)); textBox3.Text =
i.ToString();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void button2_Click(object sender, EventArgs e)
{
try
{
//storing the result in int i
int i = cal.Sub(int.Parse(textBox1.Text), int.Parse(textBox2.Text)); textBox3.Text =
i.ToString();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}

Output:
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

1. Addition :

2. Subtraction:
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

1D] Create an application to demonstrate following operations


i. Generate Fibonacci series.
ii. Test for prime numbers.
iii. Test for vowels.
iv. Use of foreach loop with arrays
v. Reverse a number and find the sum of digits of a number.
CODE:
Using System class Operations{

public void fibonacci()

int num1 = 0, num2 = 1, num3, i, num;

Console.Write("Enter the size of fibonacci series: "); num =

int.Parse(Console.ReadLine()); Console.Write(num1 + "" + num2 + "");

for (i = 2; i < num; ++i)

num3 = num1 + num2; Console.Write(num3 + ""); num1 = num2;

num2 = num3;

public void primeNum()

int num, i, m = 0, flag = 0;


Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Console.Write("Enter a Number:

"); num =

int.Parse(Console.ReadLine()); m

= num / 2;

for (i = 2; i <= m; i++)

if (num % i == 0)

Console.Write("Number is not Prime."); flag = 1;

break;

if (flag == 0)

Console.Write("Number is Prime.");

public void vowels()

char ch;

Console.WriteLine("Enter an alphabet :

"); ch = (char)Console.Read();

switch (ch)

{ case ‘a’:

Case ’A’:
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Case ’e’:

Case ’E’:

Case ‘i’:

Case ‘I’:

Case ‘o’:

Case ‘O’:

Case ‘u’:

Case ‘U’:

Console.WriteLine(ch + " is a vowel"); break;

default:

Console.Write(ch + "is a consonant"); break;

public void forEach()

string[] s = { "TEST", "FOR", "FOREACH", "LOOP" };

foreach (String str in s)

Console.WriteLine(str);

}
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

public void sum()

{+

int num, copy, rev = 0, rem, sumDigits = 0;

Console.Write("Enter number: "); num =

int.Parse(Console.ReadLine()); copy = num;

while (num > 0)

rem = num % 10; rev = rev * 10 + rem;

sumDigits = sumDigits + rem; num = num / 10;

Console.WriteLine("Reverse of " + copy + ":" + rev);

Console.WriteLine("Sum of digits:" + sumDigits);

class practical

public static void Main()

int no;

Operations obj = new Operations();

Console.WriteLine("Enter your choice");


Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Console.WriteLine("1.generate fibonacci series");

Console.WriteLine("2.test for prime numbers");

Console.WriteLine("3.test for vowels");

Console.WriteLine("4.use of foreach loop with arrays");

Console.WriteLine("5.reverse a number and find sum of digits"); no =


Convert.ToInt32(Console.ReadLine()); switch (no)

case 1: obj.fibonacci();

break; case 2:

obj.primeNum(); break;

case 3:

obj.vowels();

break; case 4:

obj.forEach();

break; case 5:

obj.sum();

break; default:

Console.WriteLine("Enter a number between 1 and 5"); break;

}
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

OUTPUT:

1. Fibonacci series:

2.Prime Numbers:

3. VOWEL:

4. Foreach loop with arrays:


Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

5. Reverse no. and find sum:

PRACTICAL-2

2. Create simple application to demonstrate use of following concepts


i. Function Overloading
ii . Inheritance (all types)
iii. Constructor overloading
iv. Interfaces
v. Using Delegates and events
vi. Exception handling
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

i. Function Overloading ;-
Code:

using System;

class Functionoverloading

public int Add(int a, int b)

int sum = a + b;

return sum;

public int Add(int a, int b, int c)

int sum = a + b + c;

return sum;

public static void Main(String[] args)

Functionoverloading obj = new Functionoverloading();


int sum1 = obj.Add(4,5);

Console.WriteLine("sum of the two " + "integer value : " + sum1);

Console.ReadLine();
int sum2 =
obj.Add(1, 4, 5);

Console.WriteLine("sum of the three " + "integer value : " + sum2);


Console.ReadLine();

}
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Output:

ii. Inheritance (all types)


Code :

using System;
class A
{
public void show()
{
Console.WriteLine("Parent Class");
}
}
class B : A
{
public void print()
{
Console.WriteLine("Child Class");
}
}
class test
{
public static void Main(string[] args)
{
B s = new B(); s.show();
s.print();
Console.ReadLine();
}
}
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Output:

2. Multilevel:

Code:

using System;
public class A
{
public void show()
{
Console.WriteLine("class A");
Console.ReadLine();
}
}
public class B : A
{
public void show1()
{
Console.WriteLine("class B");
Console.ReadLine();
}
}
public class C : B
{
public void show2()
{
Console.WriteLine("class C");
Console.ReadLine();
}
}
class multilevel
{
public static void Main(string[] args)
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

{
C ob = new C(); ob.show1(); ob.show2(); Console.ReadLine();
}
}

Output:

3. Hierarchical Inheritance:

Code:

using System;

class parent
{

public void display()

Console.WriteLine("This is parent"); Console.ReadLine();

class child1 : parent

public void show1()

Console.WriteLine("THIS is first child"); Console.ReadLine();

class child2 : parent


Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

public void show2()

Console.WriteLine("this is second child"); Console.ReadLine();

class demo

public static void Main(string[] args)

child1 c1 = new child1();

c1.display();
c1.show1();

child2 c2 = new child2();

c2.display();
c2.show2();
Console.ReadLin
e();

Output:
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

4. Hybrid Inheritance:

Code:

using System;
class parent
{
public void display()
{
Console.WriteLine("I am parent ");
}
}
class child1 : parent
{
public void display1()
{
Console.WriteLine("I am 1st child of parent");
}
}
class subchild : child1
{
public void show()
{
Console.WriteLine("I am child of child1");
}
}
class child2 : parent
{
public void display2()
{
Console.WriteLine("I am 2nd child of parent");
}
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

}
class test
{
public static void Main(string[] args)
{
child1 c1 = new child1();
c1.display(); c1.display1(); child2 c2 = new child2();
c2.display(); c2.display2(); subchild s = new subchild(); s.display();
s.display1();
s.show();
Console.ReadLine();
}
} using System;
class parent
{
public void display()
{
Console.WriteLine("I am parent ");
}
}
class child1 : parent
{
public void display1()
{
Console.WriteLine("I am 1st child of parent");
}
}
class subchild : child1
{
public void show()
{
Console.WriteLine("I am child of child1");
}
}
class child2 : parent
{
public void display2()
{
Console.WriteLine("I am 2nd child of parent");
}
}
class test
{
public static void Main(string[] args)
{
child1 c1 = new child1();
c1.display(); c1.display1(); child2 c2 = new child2();
c2.display(); c2.display2(); subchild s = new subchild(); s.display();
s.display1();
s.show();
Console.ReadLine();
}
}

Output:
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

iii. Constructor overloading:


using System;
class ConstructorOverloading
{
int a, b, c, d; public ConstructorOverloading()
{
Console.WriteLine(" Default constructor");
}
public ConstructorOverloading(int x, int y)
{
a = x; b = y;
Console.WriteLine(" Parameterized constructor:A= " + a + " B= " + b);
}
public ConstructorOverloading(ConstructorOverloading d2)
{
int c = d2.a; int d = d2.b;
Console.WriteLine(" Copy constructor:A= " + c + " B= " + d);
}
}
class program
{
public static void Main(string[] args)
{
ConstructorOverloading d1 = new ConstructorOverloading();
ConstructorOverloading d2 = new ConstructorOverloading(1, 2);
ConstructorOverloading d3 = new ConstructorOverloading(d2); Console.ReadLine();
}
}

Output:
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

iv. Interface
Code:
using System;
interface I1
{
void show();
}
interface I2
{
void display();
}
class A : I1, I2
{
public void show()
{
Console.WriteLine(" First interface method");
}
public void display()
{
Console.WriteLine(" Second interface method");
}
}
class Interface
{
public static void Main(string[] args)
{
A a = new A(); a.show();
a.display();
Console.ReadLine();
}
}

using System;
interface I1
{
void show();
}
interface I2
{
void display();
}
class A : I1, I2
{
public void show()
{
Console.WriteLine(" First interface method");
}
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

public void display()


{
Console.WriteLine(" Second interface method");
}
}
class Interface
{
public static void Main(string[] args)
{
A a = new A(); a.show();
a.display();
Console.ReadLine();
}
}

Output:

v. Using delegates and events.

Code:
using System;
namespace Delegates;
public delegate void MyDel(string str);
class EventProgram
{
public event MyDel MyEvent;
public void show(string username)
{
Console.WriteLine("Welcome " + username);
}
static void Main(string[] args)
{
EventProgram obj1 = new EventProgram(); MyDel d = new MyDel(obj1.show);
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

obj1.MyEvent += d; obj1.MyEvent("Abhay Daundkar");


Console.ReadLine();
}
}

Output:

vi. Exception handling:


Code:
using System;
public class exception
{
public static void Main(string[] args)
{
try
{
int a = 8; int b = 2; Console.WriteLine(a / b);
}
catch (Exception e)
{
Console.WriteLine(e);
Console.WriteLine("invalid");
Console.ReadLine();
}
}
}
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Output:
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

PRACTICAL 3

3A) a. Create a simple web page with various server controls to demonstrate
setting and use of their properties. (Example: AutoPostBack)
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Code:
.Cs :
using System;
using System.Collections.Generic;
using System.Linq;
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Students_data
{
public partial class Students_entry : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
String name = "Welcome to AWP";
if (ViewState["name"] == null)
{
ViewState["name"] = name;
}

protected void Button1_Click(object sender, EventArgs e)


{
Label1.Text = ViewState["name"].ToString();

protected void TextBox1_TextChanged(object sender, EventArgs e)


{
Label2.Text = TextBox1.Text;

protected void CheckBox1_CheckedChanged(object sender, EventArgs e)


{
Label3.Text = CheckBox1.Text;

protected void CheckBox2_CheckedChanged(object sender, EventArgs e)


{
Label5.Text = CheckBox2.Text;

protected void RadioButton1_CheckedChanged(object sender, EventArgs e)


{
Label4.Text = RadioButton1.Text;

protected void RadioButton2_CheckedChanged(object sender, EventArgs e)


{
Label5.Text = RadioButton1.Text;

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)


{
Label5.Text = DropDownList1.SelectedItem.Text;
}

protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)


Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

{
for (int i = 0; i < ListBox1.Items.Count; i++)
{
if (ListBox1.Items[i].Selected == true)
{ TextBox2.Text = TextBox2.Text + "" + ListBox1.Items[i].Text; }
}

}
}
}

.aspx :
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Students_entry.aspx.cs"
Inherits="Students_data.Students_entry" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div style="height: 653px">
VIEW STATE DATA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="VIEW STATE DATA" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label1" runat="server" Text="WELCOME TO AWP"></asp:Label>
<br />
<br />
ENTER YOUR NAME&nbsp; :&nbsp;
<asp:TextBox ID="TextBox1" runat="server" OnTextChanged="TextBox1_TextChanged"
Width="240px"></asp:TextBox>
<br />
<br />
SELECT HOBBIES&nbsp; :
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True"
OnCheckedChanged="CheckBox1_CheckedChanged" Text="PLAYING" />
&nbsp;&nbsp;&nbsp;&nbsp;
<asp:CheckBox ID="CheckBox2" runat="server" AutoPostBack="True"
OnCheckedChanged="CheckBox2_CheckedChanged" Text="READING" />
<br />
<br />
SELECT GENDER :
<asp:RadioButton ID="RadioButton1" runat="server" Text="MALE" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:RadioButton ID="RadioButton2" runat="server" Text="FEMALE" />
<br />
<br />
SELECT CLASS&nbsp;&nbsp; : <asp:DropDownList ID="DropDownList1" runat="server"
AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem>FYIT</asp:ListItem>
<asp:ListItem>SYIT</asp:ListItem>
<asp:ListItem>TYIT</asp:ListItem>
</asp:DropDownList>
<br />
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

<br />
SELECT DIVISION&nbsp; : <asp:ListBox ID="ListBox1" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="ListBox1_SelectedIndexChanged">
<asp:ListItem>A</asp:ListItem>
<asp:ListItem>B</asp:ListItem>
<asp:ListItem>C</asp:ListItem>
<asp:ListItem>D</asp:ListItem>
</asp:ListBox>
<br />
<br />
<br />
YOUR NAME
IS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
<br />
<br />
YOUR HOBBIES ARE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label3" runat="server" Text="Label"></asp:Label>
<br />
<br />
YOUR GENDER IS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label4" runat="server" Text="Label"></asp:Label>
<br />
<br />
YOUR CLASS
IS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label5" runat="server" Text="Label"></asp:Label>
<br />
<br />
YOUR DIVISION IS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<br />
<br />
</div>
</form>
</body>
</html>

Design :
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Output :
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

3B .) Demonstrate the use of Calendar control to perform following


operations.
i. Display messages in a calendar control
ii. Display vacation in a calendar control
iii. Selected day in a calendar control using style
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Code :
.cs :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Calendar
{
public partial class Calendar : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

protected void Button1_Click(object sender, EventArgs e)


{
Calendar1.Caption = "mycalender";
Calendar1.FirstDayOfWeek = FirstDayOfWeek.Sunday;
Calendar1.NextPrevFormat = NextPrevFormat.ShortMonth;
Calendar1.TitleFormat = TitleFormat.Month;
Label1.Text = Calendar1.SelectedDate.Date.ToString();
Label2.Text = Calendar1.TodaysDate.ToShortDateString();
Label3.Text = "19-10-2022";

TimeSpan d = new DateTime(2022, 9, 10) - DateTime.Now;


Label4.Text = d.Days.ToString();
TimeSpan d1 = new DateTime(2022, 12, 31) - DateTime.Now;
Label5.Text = d1.Days.ToString();
if (Calendar1.SelectedDate.ToShortDateString() == "19-10-2022")
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Label3.Text = "<b>Ganpati festival start<b>";


if (Calendar1.SelectedDate.ToShortDateString() == "9-14-2022")
Label3.Text = "<b>Ganpati festival end<b>";
}

protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)


{
if (e.Day.Date.Day == 15 && e.Day.Date.Month == 8)
{
e.Cell.BackColor = System.Drawing.Color.Thistle;
e.Cell.Text = "Independence Day";
}

if (e.Day.Date.Day == 10 && e.Day.Date.Month == 9)


{
Calendar1.SelectedDate = new DateTime(2022, 9, 10);
Calendar1.SelectedDates.SelectRange(Calendar1.SelectedDate, Calendar1.SelectedDate.AddDays(10));
e.Cell.Text = "Ganpati";

}
}
}
}

.aspx :
< !DOCTYPE html >

< html xmlns = "http://www.w3.org/1999/xhtml" >


< head runat = "server" >
< title ></ title >
</ head >
< body >
< form id = "form1" runat = "server" >
< div style = "height: 615px" >
< asp:Calendar ID = "Calendar1" runat="server" BackColor="Pink" BorderColor="Black"
BorderStyle="Solid" DayNameFormat="Full" ForeColor="Purple" Height="283px" NextPrevFormat="FullMonth"
OnDayRender="Calendar1_DayRender" Width="534px">
<DayHeaderStyle BackColor="Aqua" />
</asp:Calendar >
< br />
YOUR SELECTED DATE IS&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; < asp:Label ID = "Label1" runat="server" Text="Label"></asp:Label >
< br />
< br />
TODAY &#39;S
DATE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
< asp:Label ID = "Label2" runat="server" Text="Label"></asp:Label >
< br />
< br />
GANPATI VACATION START&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
< asp:Label ID = "Label3" runat="server" Text="Label"></asp:Label >
< br />
< br />
DAYS & nbsp; REMAINING FOR GANPATI VACATION&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;
< asp:Label ID = "Label4" runat="server" Text="Label"></asp:Label >
< br />
< br />
DAYS REMAINING FOR NEW YEAR&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
< asp:Label ID = "Label5" runat="server" Text="Label"></asp:Label >
< br />
< br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
< asp:Button ID = "Button1" runat="server" OnClick="Button1_Click" Text="SHOW CALENDAR INFO" />
</div>
</form>
</body>
</html>

Design :

Output :
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Code :

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"


Inherits="WebApplication6.WebForm1" %>

<!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"
OnSelectedNodeChanged="TreeView1_SelectedNodeChanged">
<Nodes>
<asp:TreeNode Text="Pillai Collage" Value="Pillai Collage"></asp:TreeNode>
<asp:TreeNode Text="TYIT" Value="TYIT">
<asp:TreeNode Text="SEM I" Value="SEM I"></asp:TreeNode>
<asp:TreeNode Text="SEM II" Value="SEM II"></asp:TreeNode>
<asp:TreeNode Text="SEM III" Value="SEM III"></asp:TreeNode>
<asp:TreeNode Text="SEM IV" Value="SEM IV"></asp:TreeNode>
<asp:TreeNode Text="SEM V" Value="SEM V"></asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
</div>
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

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

Output :
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Practical 4
Working with Form Controls
a. Create a Registration form to demonstrate use of various Validation
controls.

b. Create Web Form to demonstrate use of Ad rotator Control.

c. Create Web Form to demonstrate use of User Controls.

Registrationform.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="registrationform.aspx.cs"


Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Inherits="registration8416.registrationform" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

<style type="text/css">

.auto-style1
{ width:
100%;

.auto-style2
{ height: 31px;

.auto-style3
{ width:
229px;

.auto-style4
{ height: 31px;
width: 229px;

.auto-style5
{ width:
218px;

.auto-style6
{ height: 31px;
width: 218px;

</style>

</head>

<body>
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

<form id="form1" runat="server">


<div>

Registration Form<br />

<table class="auto-style1">

<tr>

<td class="auto-style3">Name</td>

<td class="auto-style5">

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

</td>

<td>

<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"

ControlToValidate="TextBox1" Display="Dynamic" ErrorMessage="RequiredFieldValidator"

ForeColor="#FF3300" SetFocusOnError="True">* Name is compulsory</asp:RequiredFieldValidator>

</td>

</tr>

<tr>

<td class="auto-style4">Password</td>

<td class="auto-style6">

<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>

</td>

<td class="auto-style2">

<asp:CustomValidator ID="CustomValidator1" runat="server" Display="Dynamic"

ErrorMessage="CustomValidator" ForeColor="#FF3300"

OnServerValidate="CustomValidator1_ServerValidate">Should be between 8 &amp;

13</asp:CustomValidator>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"

ControlToValidate="TextBox2" Display="Dynamic" ErrorMessage="RequiredFieldValidator"

ForeColor="#FF3300" SetFocusOnError="True">* Password is


required</asp:RequiredFieldValidator>
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

</td>

</tr>

<tr>

<td class="auto-style3">Confirm Password</td>

<td class="auto-style5">

<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>

</td>

<td>

<asp:CompareValidator ID="CompareValidator1" runat="server"

ControlToCompare="TextBox2" ControlToValidate="TextBox3" Display="Dynamic"

ErrorMessage="CompareValidator" ForeColor="Red" SetFocusOnError="True">Password doesnt


match</asp:CompareValidator>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"

ControlToValidate="TextBox3" Display="Dynamic" ErrorMessage="RequiredFieldValidator"

ForeColor="#FF3300" SetFocusOnError="True">Re enter the


password</asp:RequiredFieldValidator>

</td>

</tr>

<tr>

<td class="auto-style3">Email</td>

<td class="auto-style5">

<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>

</td>

<td>

<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"


ControlToValidate="TextBox4" Display="Dynamic" EnableViewState="False" ErrorMessage="Email is
wrong" ForeColor="Red" SetFocusOnError="True"

ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">Email is
wrong</asp:RegularExpressionValidator>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"

ControlToValidate="TextBox4" Display="Dynamic" ErrorMessage="RequiredFieldValidator"

ForeColor="#FF3300" SetFocusOnError="True">* Email is compulsory</asp:RequiredFieldValidator>

</td>

</tr>

<tr>

<td class="auto-style3">Mobile Number</td>

<td class="auto-style5">

<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>

</td>

<td>

<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server"

ControlToValidate="TextBox5" Display="Dynamic" ErrorMessage="RegularExpressionValidator"


ForeColor="Red" SetFocusOnError="True" ValidationExpression="^[7-9][0-9]{9}$">Phone number
is not Indian</asp:RegularExpressionValidator> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"

ControlToValidate="TextBox5" Display="Dynamic" ErrorMessage="RequiredFieldValidator"


ForeColor="#FF3300" SetFocusOnError="True">* Phone number is
compulsory</asp:RequiredFieldValidator>

</td>

</tr>

<tr>

<td class="auto-style3">Age</td>

<td class="auto-style5">

<asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>

</td>

<td>

<asp:RangeValidator ID="RangeValidator1" runat="server"

ControlToValidate="TextBox6" Display="Dynamic" ErrorMessage="RangeValidator" ForeColor="Red"


MaximumValue="100" MinimumValue="8" SetFocusOnError="True" Type="Integer">Thats not
correct age</asp:RangeValidator>
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server"


ControlToValidate="TextBox6" Display="Dynamic" ErrorMessage="RequiredFieldValidator"

ForeColor="#FF3300" SetFocusOnError="True">* Age is compulsory</asp:RequiredFieldValidator>

</td>

</tr>

<tr>

<td class="auto-style3">&nbsp;</td>

<td class="auto-style5">

<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Smash It!" />


</td>

<td>&nbsp;</td>

</tr>

</table>

</div>

</form>

</body>

</html>

Success.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="success.aspx.cs"

Inherits="registration8416.success" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">


Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

<div>

<h3>You have successfully registered</h3>

</div>

</form>

</body>

</html>

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

namespace registration8416

{ public partial class registrationform :


System.Web.UI.Page

{ protected void Page_Load(object sender, EventArgs


e)

protected void Button1_Click(object sender, EventArgs e)

Response.Redirect("success.aspx");

protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)

int len = args.Value.Length;


if(len>=8 && len <= 13)

args.IsValid = true;
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

else

args.IsValid = false;

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>

<appSettings>

<add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/>


</appSettings>

<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,


Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default

/nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />


</compilers>

</system.codedom>

</configuration>

Output:
Validator for Name: (RequiredField Vaildator)

Validator For Password, Email, Phone number, Age.


For Password: Compare Validator, Required Field Validator
For Email: Regular Expression (Validation Expression: Internet Email Address), Required Field
Validator.
For Phone Number: Regular Expression (Validation Expression: Custom (for Indian Phone number),
Required Field Validator.
For Age: Range Validator (Maximum 100, Minimum 8), Required Field Validator.
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

When all validations are successfully completed:

After hitting smash button

Practical 5 : Working with Navigation, Beautification and


Master page.

5 A) a. Create Web Form to demonstrate use of Website Navigation


controls and Site Map.
What is a Site Map File?
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

A SiteMap object is a component of the ASP.NET site navigation infrastructure


that provides access to read-only site map information for page and control
developers using navigation and SiteMapDataSource controls.

Explain Navigation Controls in Asp .net.

1. SiteMapPath Control
Site maps are XML files which are mainly used to describe the logical structure
of the web application. It defines the layout of all pages in a web application
and how they relate to each other. Whenever you want you can add or remove
pages to your site map there by managing navigation of the website efficiently.
Site map files are defined with .sitemap extension. <sitemap> element is the
root node of the sitemap file.
It has three attributes:
Title: It provides a textual description of the link.
URL: It provides the location of the valid physical file.
Description: It is used for the tooltip of the link.

2. Menu Control
Menu is another navigation control in ASP.NET which is used to display menus
in web pages. This control is used in combination with SiteMapDataSource
control for navigating the web Site. It displays two types of menu: static menu
and dynamic menu. Static menu is always displayed in menu Control, by default
only menu items at the root levels are displayed. Dynamic menu is displayed
only when the user moves the mouse pointer over the parent menu that contains
a dynamic sub menu.

3. TreeView Control
TreeView is another navigation control used in ASP.NET to display the data in
a hierarchical list manner. When TreeView is displayed for the first time, it
displays all of its nodes. Users can control it by setting the property called
ExpandDepth.

TYIT.master
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="TYIT.master.cs" Inherits="practical_5.TYIT"


%>

<!DOCTYPE html>

<html>
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
<style type="text/css">
.auto-style1 {
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">

<table class="auto-style1">
<tr>
<td class="auto-style1"> <h1> Library
<table class="auto-style1">
<tr>
<td>
<asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1" Height="77px"
Width="95px">
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
<br />
<asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1">
</asp:TreeView>
</td>
</tr>
</table>
</h1></td>
</tr>
<tr>
<td>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
<tr>
<td><footer> CopyRight TYIT - A NEERAJ </footer></td>
</tr>
</table>

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

Split view
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

HOME.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/TYIT.Master" AutoEventWireup="true"
CodeBehind="HOME.aspx.cs" Inherits="practical_5.HOME" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<h3> this is Library home page </h3>
</asp:Content>

Split view
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Output

CART.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/TYIT.Master" AutoEventWireup="true"
CodeBehind="CART.aspx.cs" Inherits="practical_5.CART" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<h3>this is cart page </h3>
</asp:Content>

Split view
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Output

BOOKS.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/TYIT.Master" AutoEventWireup="true"
CodeBehind="BOOKS.aspx.cs" Inherits="practical_5.BOOKS" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<h3>this is book page </h3>
</asp:Content>

Split view
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Output

Web.sitemap
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/HOME.ASPX" title="HOME" description="">

<siteMapNode url="~/Cart" title="CART" description="" > </siteMapNode>

<siteMapNode url="~/Aboutus.ASPX" title="ABOUT US" description="" > </siteMapNode>

<siteMapNode url="~/Books.ASPX" title="BOOKS" description="" >


<siteMapNode url="list1.aspx" title="JAVA BOOKS" description="" />
<siteMapNode url="list2.aspx" title="PYTHON BOOKS" description="" />
<siteMapNode url="list3.aspx" title="DBMS BOOKS" description="" />
</siteMapNode>
</siteMapNode>

</siteMap>
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

5 B) b. Create a web application to demonstrate the use of Master Page with


applying Styles and Themes for page beautification.
Master Pages
One of the key components to a successful Web site is a consistent look and
feel. In ASP.NET
1.x, developers used user controls to replicate common page elements across a
Web application. While that is certainly a workable solution, using user controls
does have some drawbacks. For example, a change in position of a user control
requires a change to multiple pages across a site. User controls are also not
rendered in Design view after being inserted on a page.

Content Placeholder
Defines a region for content in an ASP.NET master
page. public class ContentPlaceHolder :
System.Web.UI.Control A ContentPlaceHolder
control defines a relative region for content in a
master page, and renders all text, markup, and
server controls from a related Content control found
in a content page.

Materpage.master
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="masterpage.master.cs"
Inherits="Practical_5B.masterpage" %>

<!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>
<link href="StyleSheet1.css" rel="stylesheet" />
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
<style type="text/css">
.style1
{
width: 90px;
height: 50px;
text-align:center;
}
#header
{
text-align:center;
background-color:Lime;
}
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1 id="header"> WebSite.</h1>
<table align="center">
<tr>
<td class="style1"><a href="WebForm1.aspx">Home Page</a></td>
<td class="style1"><a href="WebForm2.aspx">Cart Page</a></td>
</tr>
</table>
<asp:ContentPlaceHolder id="ContentPlaceHolder1"
runat="server"></asp:ContentPlaceHolder>

<!-- footer -->

<footer>
<div id="footer" align="center" class="container-fluid">
<div class="row">
<div class="text-center">
<p style="color:whitesmoke">&copy All right Reversed - TYIT A</p>
</div>
</div>
</div>
</footer>
<!-- ./Footer -->
</div>
</form>
</body>
</html>

Split view
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

StyleSheet1.css
#footer {
background: #531f00;
}

WebForm1.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/masterpage.Master" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="Practical_5B.WebForm1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<style type="text/css">
.s1{font-weight:bolder;font-style:italic;text-align:center;background-color:Aqua;}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h1 class="s1"> Home page of WebSite</h1>
<asp:Button SkinID="blue" ID="Button1" runat="server" Text="Blue" BackColor="Blue" />
<asp:Button SkinID="orange" ID="Button2" runat="server" Text="Orange" BackColor="Orange" />
</asp:Content>

Split view
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Output

WebForm2.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/masterpage.Master" AutoEventWireup="true"
CodeBehind="WebForm2.aspx.cs" Inherits="Practical_5B.WebForm2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<style type="text/css">
.s1{font-weight:bolder;font-style:italic;text-align:center;background-color:Orange;}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h1 class="s1"> Cart page of WebSite</h1>
<asp:Button SkinID="Red" ID="Button1" runat="server" Text="Red" BackColor="Red" />
<asp:Button SkinID="Yellow" ID="Button2" runat="server" Text="Yellow" BackColor="Yellow" />
</asp:Content>

Split view

Output
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Skin1.skin
<asp:Button SkinID="Red" runat="server" Text="RED" BackColor="Red" BorderColor="Black"/>
<asp:Button SkinID="Yellow" runat="server" Text="YELLOW" BackColor="Yellow"
BorderColor="Black" />
<asp:Button SkinID="blue" runat="server" Text="BLUE" BackColor="#0066FF"
BorderColor="Black" />
<asp:Button SkinID="orange" runat="server" Text="ORANGE" BackColor="#FF9900"
BorderColor="Black" />
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

PRACTICAL NO 6

1. What is connected architecture in ado.net?


Ans—the Database gets connected to the front end then the command
passes the query to the server from the back end and on the server the
result which has been generated.

2. What is Ado. Net objects?


Ans—
● CONNECTION-
The Connection object represents a connection to the data source. The
connection could be shared among different command objects.
● COMMAND-
The Command object represents the command or a stored procedure
sent to the database from retrieving or manipulating data.
● DATAREADER-
The DataReader object is an alternative to the DataSet and
DataAdapter combination. This object provides a connection oriented
access to the data records in the database. These objects are suitable
for read-only access, such as populating a list and then breaking the
connection.

3. Namespace used to connect Ado. Net


Ans--
● System.Data-
It defines classes that represent table, columns, row, and datasets
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

● System.Data.Common-
namespace defines common classes. These classes are base classes for
concrete data provider classes.
● System.Data.Oledb-
Namespace defines classes to work with OLE-DB data sources
using.NET OleDb data providers.
● System.Data.SqlClient-
namespaces define Sql.NET data provider classes to work with SQL
server 7.0 or later databases.
● System.Data.SqlTypes-
providers a group classes representing the specific types found in
SQL server. Some of these classes are SqlBinary SqlMoney,
SqlString, SqlDouble, SqlDateTime, and SqlNumeric.

4. What is the use of the ExecuteNonQuery() method?


Ans-- Use this operation to execute any arbitrary SQL statements in
SQL Server if you do not want any result set to be returned. You can
use this operation to create database objects or change data in a
database by executing UPDATE, INSERT, or DELETE statements.
5. What is the use of the ExecuteReader() method?
Ans-- Use this operation to execute any arbitrary SQL statements in
SQL Server if you want the result set to be returned, if any, as an
array of DataSet.
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

WebForm1.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.SqlClient;
using System.Configuration;

namespace CRUDdem
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

protected void btnAdd_Click(object sender, EventArgs e)


Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

{
SqlConnection conn = new
SqlConnection(ConfigurationManager.ConnectionStrings["StudentCo
nnectionString"].ConnectionString);
conn.Open();
SqlCommand cmd = new SqlCommand("insert into
student(roll_no,name,marks) values
(@rollno,@name,@marks)",conn);
cmd.Parameters.AddWithValue("@rollno",tbRollNo.Text);
cmd.Parameters.AddWithValue("@name", tbName.Text);
cmd.Parameters.AddWithValue("@marks", tbMarks.Text);
cmd.ExecuteNonQuery();

Response.Write("Successfully Added Data");


conn.Close();
}

protected void btnSearch_Click(object sender, EventArgs e)


{
try
{
SqlConnection conn = new
SqlConnection(ConfigurationManager.ConnectionStrings["StudentCo
nnectionString"].ConnectionString);
conn.Open();
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

SqlCommand cmd = new SqlCommand("select * from


student where roll_no=" +tbRollNo.Text, conn);
SqlDataReader dr = cmd.ExecuteReader();
GridView1.DataSource = dr;
GridView1.DataBind();

conn.Close();
}
catch(Exception ex)
{
Response.Write(ex.ToString());
}
}

protected void btnDelete_Click(object sender, EventArgs e)


{
SqlConnection conn = new
SqlConnection(ConfigurationManager.ConnectionStrings["StudentCo
nnectionString"].ConnectionString);
conn.Open();
SqlCommand cmd = new SqlCommand("delete from student
where roll_no=" + tbRollNo.Text, conn);
cmd.ExecuteNonQuery();
Response.Write("Successfully Deleted Data");
conn.Close();
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

protected void btnUpdate_Click(object sender, EventArgs e)


{
SqlConnection conn = new
SqlConnection(ConfigurationManager.ConnectionStrings["StudentCo
nnectionString"].ConnectionString);
conn.Open();
SqlCommand cmd = new SqlCommand("update student set
name=@name,marks=@marks where roll_no=" +tbRollNo.Text,
conn);
cmd.Parameters.AddWithValue("@rollno", tbRollNo.Text);
cmd.Parameters.AddWithValue("@name", tbName.Text);
cmd.Parameters.AddWithValue("@marks", tbMarks.Text);
cmd.ExecuteNonQuery();

Response.Write("Successfully Updated");
conn.Close();
}
}
}

Web.Config :
<connectionStrings>
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

<add name="StudentConnectionString" connectionString="Data


Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|
DataDirectory|\Database1.mdf;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>

Output :

Student Table

Add Details
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Search Details
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Update
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Delete
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Practical - 7 : Create a web application to display Using


Disconnected Data Access and Data Binding using Grid
View.

Dashboard.aspx :

Dashboard.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; using
System.Data.SqlClient; using System.Configuration;

namespace disconectedArchitecture
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

{ public partial class Dashboard :


System.Web.UI.Page
{ protected void Page_Load(object sender,
EventArgs e)
{

}
private void GetDetails()
{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["Connectio
nString"].Co nnectionString);
SqlDataAdapter da = new SqlDataAdapter("Select * from
student", con);
DataSet ds = new DataSet();
da.Fill(ds, "StudentDetails");
GridView2.DataSource = ds;
GridView2.DataBind();
Label1.Text = "Data Added to Dataset";

}
protected void getbtn_Click(object sender, EventArgs e)
{
GetDetails();
}
}
}
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Output :
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Practical 8

Aim: Working with GridView control : Create a web application


to demonstrate use of GridView button column and GridView
events

Webform1.aspx
Code:
<!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/xhtul">
<head runat "server">
<title></title>
</head>
<body>
<form id="forml" runat="server">
<div style="font-family: Arial">
<asp:Button ID-"btnGetDataFromDB runat="server" Text="Get Data
from Database" />
<asp:GridView ID="gvStudents' runat=server"
AutoGenerateColumns "False"
DatakeyNames "ID" >
<Columns>
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

<asp:CommandField ShowDeleteButton-"True"
ShowEditButton-"True" />
<asp:BoundField DataField="ID" Header Text="ID"
Insertvisible="False"
ReadOnly="True" Sort Expression="ID" />
<asp:BoundField DataField="Name" Header Text="Name"
SortExpression="Name" />
<asp:BoundField DataField="Gender" HeaderText="Gender"
SortExpression="Gender" />
<asp:BoundField DataField-"TotalMarks" Header Text-"TotalMarks"
SortExpression-"TotalMarks" />
</Columns >
</asp:GridView>
<asp:Label ID="lblMessage" runat="server" Text="Label">
</asp:Label>
<asp:Button ID="btnUpdateDB' runat="server" Text="Button" />
<asp:SqlDataSource
ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DBCS %>"
DeleteCommand="DELETE FROM
[tb]Students] WHERE [ID] = @ID" InsertCommand="INSERT
INTO [tblStudents] ([Name], [Gender],
[TotalMarks]) VALUES (@Name, @Gender, @TotalMarks)"
SelectCommand="SELECT * FROM [tblStudents]"
UpdateCommand="UPDATE [tblStudents] SET [Name] = @Name,
[Gender] = @Gender,
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

[TotalMarks] = @TotalMarks WHERE [ID]


<DeleteParameters>
<asp:Parameter Name="ID" Type="Int32" />
</DeleteParameters>
<InsertParameters >
<asp: Parameter Name="Name" Type="String" />
<asp:Parameter Name="Gender" Type="String" />
<asp:Parameter Name="TotalMarks" Type="Int32" />
</InsertParameters>
<UpdateParameters >
<asp:Parameter Name="Name" Type="String" />
<asp: Parameter Name="Gender" Type="String" />
<asp:Parameter Name="TotalMarks" Type="Int32" />
<asp:Parameter Name="ID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
</div>
</form>
</body>
</html>

Design

<body>
<form id="form1" runat="server">
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

<div style="font-family:Arial">
<asp:Button ID="btnGetDataFromDB" runat="server" Text="Get
Data from Database" />
<asp:GridView ID="gvStudents' runat="server"
AutoGenerateColumns="False"
DatakeyNames="ID">
<Columns>
<asp:CommandField ShowDeleteButton="True"
ShowEditButton="True" />
<asp:BoundField DataField="ID" HeaderText="ID"
InsertVisible="False"
ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="Name" HeaderText="Name"
SortExpression="Name" />
<asp:BoundField DataField="Gender" Header Text="Gender"
SortExpression="Gender" />
<asp:BoundField DataField="TotalMarks" HeaderText="TotalMarks"
SortExpression="totalMarks" />
</Columns>
</asp:GridView>
<asp:Button ID="btnUpdateDB" runat="server" Text="Update
Database Table" />
<asp:Label ID="lblMessage" runat="server">
</asp:Label>
</div>
</form>
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

</body>

WebForm1.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; using
System.Data.SqlClient; using
System.Configuration;

namespace WebFormsDemo
{
public partial class WebForm1 : System.Web.UI.Page
{
}
private void GetDataFromDB()
{
string CS = ConfigurationManager.ConnectionStrings
["DBCS").ConnectionString; SqlConnection con = new
SqlConnection(CS); string strSelectQuery = "Select *
from tblStudents";
SqlDataAdapter da = new SqlDataAdapter(strSelectQuery, con);
DataSet ds = new
DataSet(); da.Fill(ds,
"Students");
ds. Tables["Students"].PrimaryKey = new DataColumn[] { ds.
Tables["Students"].Columns["ID"] };
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Cache. Insert("DATASET", ds, null,


DateTime.Now.AddHours(24),
System.Web.Caching.Cache.NoSlidingExpiration);
gvStudents.DataSource = ds;
gvStudents.DataBind();
}
protected void btnGetDataFromDB_Click(object sender, EventArgs
e)
{
GetDataFromDB();
lblMessage.Text = "Data Loaded
from Database"; }
private void GetDataFromCache()
{
if (Cache["DATASET"] != null)
{
DataSet ds = (DataSet)Cache["DATASET"];
gvStudents.DataSource = ds;
gvStudents.DataBind();
}
}
}
protected void btnGetDataFromDB_Click(object sender, EventArgs
e){
GetDataFromDB();
}
protected void gvStudents_RowEditing(object sender,
GridViewEditEventArgs e){ gvStudents. EditIndex = e.
NewEditIndex;
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

GetDataFromCache();
}
protected void gvStudents_RowUpdating(object sender,
GridViewUpdate EventArgs e)
{
if (Cache[ "DATASET"] != null)
{
DataSet ds = (DataSet)Cache [ "DATASET"];
DataRow dr = ds.
Tables["Students"].Rows.Find(e.Keys
["ID"]); dr["Name"] = e. NewValues
[ "Name"); dr["Gender"] = e.
NewValues["Gender"); dr["TotalMarks"] =
e. NewValues["TotalMarks"];
Cache. Insert("DATASET", ds, null, DateTime.Now.AddHours (24),
System.Web.Caching.Cache. NoSlidingExpiration);
gvStudents.EditIndex= -1;
GetDataFromCache();
}
}
protected void gvStudents_RowCancelingEdit(object sender,
GridViewCancelEditEventArgs e)
{
gvStudents.EditIndex= -1;
GetDataFromCache();
}
protected void gvStudents_RowDeleting(object sender,
GridViewDeleteEventArgs e)
{
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

if (Cache[ "DATASET"] != null)


{
DataSet ds = (DataSet)Cache [ "DATASET"];
DataRow dr = ds.
Tables["Students"].Rows.Find(e.Keys ["ID"]);
dr.Delete();
Cache. Insert("DATASET", ds, null, DateTime.Now.AddHours (24),
System.Web.Caching.Cache. GetDataFromCache();
}
}
protected void btnUpdateDB_Click(object sender, EventArgs e)
{
string CS = Configuration Manager.ConnectionStrings
["DBCS"].ConnectionString; SqlConnection con = new
SqlConnection(CS); string strSelectQuery = "Select * from
tblStudents";
SqlDataAdapter da = new
SqlDataAdapter(strSelectQuery, con); DataSet ds =
(DataSet|)Cache["DATASET"];
string strUpdateCommand = "Update tblStudents set Name =
@Name, Gender = @Gender,
TotalMarks = @TotalMarks where ID= @ID”;
SqlCommand updateCommand = new
SqlCommand(strUpdateCommand, con);
updateCommand.Parameters.Add("@Name", SqlDbType.NVarChar,
50, "Name"); updateCommand.Parameters.Add("@Gender",
SqlDbType.NVarChar, 20, "Gender");
updateCommand.Parameters.Add("@TotalMarks", SqlDbType.Intgr
0, "TotalMarks"); updateCommand.Parameters.Add("@Id",
SqlDbType. Int, 0, "Id"l);
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

da.UpdateCommand=
updateCommand; da.Update(ds,
"Students");
string strDeleteCommand = "Delete from tblStudents where
ID= @ID”; SqlCommand deleteCommand = new
SqlCommand(strDeleteCommand, con);
deleteCommand.Parameters.Add("@Id", SqlDbType. Int, 0,
"Id"l); da.DeleteCommand= deleteCommand;
}

protected void Page_Load(object sender, EventArgs e){


}
Output:
Edit:

Update:
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Delete:
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Practical 9

A. Write a program to demonstrate the concept of directives in


AngularJS.

Program1: Directives:
<!DOCTYPE html>
<html>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/
angular.min.js"></ script> <body>
<div ng-app="" ng-init="firstName='Juned'">
<p>Input something in the input box:</p>
<p>Name: <input type="text" ng-model="firstName"></p>
<p>You wrote: {{ firstName }}</p>
</div>
</body>
</html>
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Program2: Data Binding.


<!DOCTYPE html>
<html>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/
angular.min.js"></ script> <body>
<div data-ng-app="" data-ng-init="quantity=10;price=5">
<h2>Cost Calculator</h2>
Quantity: <input type="number" ng-model="quantity">
Price: <input type="number" ng-model="price">
<p><b>Total Cost:</b> {{quantity * price}}</p>
</div>
</body>
</html>
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

Program3: Controllers
<!DOCTYPE html>
<html>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/
angular.min.js"></ script> <body>
<div ng-app="myApp" ng-controller="myCtrl">
First Name: <input type="text" ng-model="firstName"><br>
Last Name: <input type="text" ng-model="lastName"><br>
<br>
Full Name: {{firstName + " " + lastName}}
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.firstName = "Juned";
$scope.lastName = "8487";
});
</script>
Name: ABHAY DAUNDKAR

Class: TY.I. T/A

Roll No.:8423

</body>
</html>

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy