0% found this document useful (0 votes)
134 views132 pages

15 Awp Journal

The document describes a certificate for completing a course in Advance Web Programming. It lists 11 practical assignments completed by the student over the academic year related to C#, ASP.NET, web forms, controls, navigation, databases, AJAX and XML.

Uploaded by

Nedariya mohd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
134 views132 pages

15 Awp Journal

The document describes a certificate for completing a course in Advance Web Programming. It lists 11 practical assignments completed by the student over the academic year related to C#, ASP.NET, web forms, controls, navigation, databases, AJAX and XML.

Uploaded by

Nedariya mohd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

AdvanceWebProgramming

Submitted by
KHAN ARAM
Bachelor of Science in Information
Technology
Academic Year 2021-2022

15 Aram khan
AdvanceWebProgramming

CERTIFICATE
Name: Khan Aram
Class: T.Y. BScIT Roll number:15
Branch: Bachelor of science in information
technology

This is to certify the work of the student in Bachelor of


Science in Information Technology during the academic
year 2021-2022 has been successfully completed.

Prof. SwetaSuman

Examiners’sign

Date: 30thSept 2021

15 Aram khan
AdvanceWebProgramming

Sr. Title Date Sign


No
1. 1. Working with basicC# 19/07/2021 Sweta Suman
and ASP .NET

a. Create an application
that obtains four intvalues
from the user and displays
theproduct.

b. Create an application to
demonstrate stringoperations.

c. Create an application that


receives the (Student Id,
Student Name, Course Name,
Date of Birth) informationfrom
a set of students. The
application should also display
the information of all the
students once the data
entered.

d. Create an application
to demonstratefollowing
operations
i. Generate Fibonacciseries.
ii. Test for primenumbers.
iii. Test for vowels.
iv. Use of foreach loopwith
arrays
v. Reverse a number andfind
sum of digits of anumber.

2. Working with Object 04/08/2021 Sweta Suman


Oriented C# and ASP .NET

a. Create simple application to


perform following operations
i. Finding factorialValue
ii. Money Conversion
iii. Quadratic Equation
iv. TemperatureConversion

15 Aram khan
AdvanceWebProgramming

b. Create simple application to


demonstrate use of following
concepts
i. FunctionOverloading
ii. Inheritance (alltypes)
iii. Constructor overloading
iv. Interfaces
c. Create simple applicationto
demonstrate use of following
concepts
i. Using Delegates andevents
ii. Exceptionhandling

3. Working with WebForms 04/08/2021 Sweta Suman


andControls

a. Create a simple web page


with various sever controls to
demonstrate setting and useof
their properties. (Example :
AutoPostBack)

b. Demonstrate the use of


Calendar control toperform
following operations.
a) Display messages ina
calendar control
b) Display vacation in
a calendarcontrol
c) Selected day in acalendar
control using style
d) Difference betweentwo
calendar dates

c. Demonstrate the use of


Treeview control perform
following operations. a)
Treeview control and datalist
b) Treeview operations

4. Working with Form 09/08/2021 Sweta Suman


Controls

a. Create a Registration form


to demonstrate use of various
Validation controls.

15 Aram khan
AdvanceWebProgramming

b. Create Web Form to


demonstrate use of Adrotator
Control.

c. Create Web Form to


demonstrate use User
Controls.

5. Working with Navigation, 16/08/2021 Sweta Suman


Beautification and Master
page.

a. Create Web Form to


demonstrate use of Website
Navigation controls andSite
Map.

b. Create a web application


to demonstrate use of Master
Page with applying Stylesand
Themes for page
beautification.

c. Create a web application to


demonstrate various statesof
[Link] Pages.

6. Working with Database 23/08/2021 Sweta Suman

a. Create a web application


bind data in a multilinetextbox
by querying in another
textbox.

b. Create a webapplication
to display records by using
database.

c. Demonstrate the useof


Datalist linkcontrol.

7. Working with Database 30/08/2021 Sweta Suman

a. Create a web application to


display Databinding using
dropdownlist control.

15 Aram khan
AdvanceWebProgramming

b. Create a web application for


to display the phone no of an
author using database.

c. Create a web application for


inserting and deleting record
from a database. (Using
Execute-Non Query).

8. Working with data controls 06/09/2021 Sweta Suman

a. Create a web application to


demonstrate various uses and
properties ofSqlDataSource.

b. Create a web application


to demonstrate databinding
using DetailsView and
FormView Control.

c. Create a webapplication
to display Using
Disconnected Data Access
and Databinding using
GridView.
9. Working with GridView 20/09/2021 Sweta Suman
control

a. Create a web application to


demonstrate use of GridView
control template andGridView
hyperlink.

b. Create a web application


to demonstrate use of
GridView button columnand
GridView events.

c. Create a web application to


demonstrate GridView paging
and Creating own tableformat
usingGridView.

10. Working with AJAX and 27/09/2021 Sweta Suman


XML

15 Aram khan
AdvanceWebProgramming

a. Create a web applicationto


demonstrate reading and
writing operation withXML.

b. Create a webapplication
to demonstrate Form
Security and Windows
Security with proper
Authentication and
Authorizationproperties.

c. Create a web applicationto


demonstrate use ofvarious
Ajax controls.
11. Programs to create and use 27/09/2021 Sweta Suman
DLL

15 Aram khan
AdvanceWebProgramming

Practical No.1
AIM: - Working with basic C# and ASP .NET
A)Createanapplicationthatobtainsfourintvaluesfromthe
user and displays the product.
Code:
using System;
using [Link];
[Link];
[Link];
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
intnum1,num2,num3,num4,prod;
[Link]("Enternumber1:");
num1 = [Link]([Link]());
[Link]("Enter number 2:");

15 Aram khan
AdvanceWebProgramming
num2 = Convert.ToInt32([Link]());
[Link]("Enter number 3:");
num3 = Convert.ToInt32([Link]());
[Link]("Enter number 4:");
num4 = Convert.ToInt32([Link]());
prod = num1 * num2 * num3 * num4;
[Link](num1+"*"+num2+"*"+num3+"*"+num4+ "="
+prod);
[Link]();
}
}
}

A) OUTPUT: -
Enternumber1:6
Enternumber2:5
Enternumber3:4
Enternumber4:3
6*5*4*3=360

15 Aram khan
AdvanceWebProgramming
B) [Link]
des:-
using System;
namespace cmdLineArgs
{
class Program
{
static void Main(string[] args)
{
string str = args[0];
int n = Convert.ToInt32(args[1]);
[Link]("String:" + str);
[Link]("Number:" + n);
}
}
}
OUTPUT:
String : Roman
Number : 10

15 Aram khan
AdvanceWebProgramming
C) Createanapplicationthatreceivesthe(StudentId,Student
Name,CourseName,DateofBirth)informationfromasetof
[Link]
ofallthestudentsoncethedataentered.
Codes: -
using System;
namespace ArrayOfStructs
{
classProgram
{
structStudent
{
publicstringstudid,name,cname;
publicintday,month,year;
}
static void Main(string[] args)
{
Student[] s = newStudent[5];
int i;

15 Aram khan
AdvanceWebProgramming
for (i = 0; i < 5;i++)
{
[Link]("Enter Student Id:");
s[i].studid = [Link]();
[Link]("Enter Student name : ");
s[i].name = [Link]();
[Link]("EnterCoursename:");
s[i].cname =[Link]();
[Link]("Enter date of birth\n Enter day(1-31):");
s[i].day = Convert.ToInt32([Link]());
[Link]("Enter month(1-12):");
s[i].month = Convert.ToInt32([Link]());
[Link]("Enter year:");

s[i].year =Convert.ToInt32([Link]());
}
[Link]("\n\nStudent's List\n");
for (i = 0; i < 5; i++)
{
[Link]("\nStudent ID : " + s[i].studid);

15 Aram khan
AdvanceWebProgramming
[Link]("\nStudent name : " + s[i].name);
[Link]("\nCourse name : " + s[i].cname);
[Link]("\nDateofbirth(dd-mm-yy):"+s[i].day+"-"+
s[i].month+
"-" + s[i].year);
}}}}
1) C) OUTPUT:
Enter Student Id:0001
EnterStudentname:Prachit
EnterCoursename:MSCit
Enter date ofbirth
Enter day(1-31):29
Enter month(1-12):9
Enter year:1995
Enter Student Id:0002
EnterStudentname:Aniket
Enter Course name : Bscit
Enter date ofbirth
Enter day(1-31):4

15 Aram khan
AdvanceWebProgramming
Enter month(1-12):3
Enter year:1996
Enter Student Id:0003
EnterStudentname:Prathamesh
Enter Course name :BMS
Enter date of birth
Enter day(1-31):9
Enter month(1-12):8
Enter year:2000
Enter Student Id:0004
EnterStudentname:Sumit
EnterCoursename:MScet
Enter date ofbirth
Enter day(1-31):25
Enter month(1-12):5
Enter year:1994
Enter Student Id : 0005
EnterStudentname:Zaid
EnterCoursename:BCOM

15 Aram khan
AdvanceWebProgramming
Enter date of birth
Enter day(1-31):6
Enter month(1-12):7
Enter year:1993
Student's List
Student ID : 0001
Studentname:Prachit
Course name :MSCit
Dateofbirth(dd-mm-yy):29-9-1995
Student ID :0002
Studentname:Aniket
Course name :Bscit
Dateofbirth(dd-mm-yy):4-3-1996
Student ID :0003
Studentname:Prathamesh
Course name :BMS
Dateofbirth(dd-mm-yy):9-8-2000
Student ID :0004

Student name : Sumit

15 Aram khan
AdvanceWebProgramming
Course name : MScet
Dateofbirth(dd-mm-yy):25-5-1994
Student ID :0005
Student name : Zaid
Course name : BCOM

Date of birth(dd-mm-yy) : 6-7-1993

15 Aram khan
AdvanceWebProgramming
D) Createanapplicationtodemonstratefollowingoperations
[i] FibonacciSeries
Codes:-

using System;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
int num1=0,num2=1,num3,num4,num,counter;
[Link]("Uptohowmanynumberyouwantfibonacciseries:");
num=[Link]([Link]());
counter=3;
[Link](num1+"\t"+num2);
while(counter<=num)

{
num3=num1+num2;
if(counter>=num)

15 Aram khan
AdvanceWebProgramming
break;
[Link]("\t" + num3);
num1 = num2;
num2 =num3;
counter++;

}
}
}
}
1) D)[i]OUTPUT:
Uptohowmanynumberyouwantfibonacciseries:5
0 1 1 23

15 Aram khan
AdvanceWebProgramming
[ii] Test for
[Link]:-
using System;
namespace testprime
{
class Program
{
static void Main(string[] args)
{
int num, counter;
[Link]("Enter number:");
num = [Link]([Link]());

for (counter = 2; counter <= num / 2; counter++)


{
if((num%counter)==0)
break;

}
if (num == 1)
[Link](num + "is neither prime nor composite");

15 Aram khan
AdvanceWebProgramming
else if(counter<(num/2))
[Link](num+"isnotprimenumber");
else
[Link](num+"is prime number");
}
}
}
OUTPUT:
(1st attempt)
Enter number:3
3isprimenumber
(2nd)
Enter number:1
1isneitherprimenorcomposite
(3rd)
Enter number:4
4 is not prime number

15 Aram khan
AdvanceWebProgramming
[iii] Testforvowels.
CODE:
using System;
namespace vowels
{
class Program
{
static void Main(string[] args)
{
char ch;
[Link]("Enter a character : ");
ch = (char)[Link]();
switch (ch)
{
case'a':
case'A':
case'e':
case'E':
case 'i':

15 Aram khan
AdvanceWebProgramming
case 'I':
case 'o':
case 'O':
case'u':
case'U':
[Link](ch + "is vowel");
break;

default:
[Link](ch+"isnotavowel");
break;
}
[Link]();
}
}
}
OUTPUT:
Enteracharacter:a a
isvowel

Enter a character : p

15 Aram khan
AdvanceWebProgramming
p is not avowel

[iv] Useofforeachloopwitharrays.
CODE:-
using System;
class ExampleForEach
{
public static voidMain()
{
string[]str={"Shield","Evaluation","DX"};
foreach (String s instr)

{
[Link](s);
}
}
OUTPUT:
Shield
Evaluation
DX

15 Aram khan
AdvanceWebProgramming
[v] [Link]
DE:
using System;
namespace reverseNumber
{
class Program
{
static void Main(string[] args)
{
int num,actualnumber,revnum=0,digit,sumDigits=0;
[Link]("Enter number:");
num = [Link]([Link]());
actualnumber = num;

while (num > 0)


{
digit = num %10;
revnum=revnum*10+digit;
sumDigits=sumDigits+digit;
num=num/10;

15 Aram khan
AdvanceWebProgramming
}
[Link]("Reverseof"+actualnumber+"="+revnum);
[Link]("Sumofitsdigits:"+sumDigits);}}}

OUTPUT:
Enter number:15
Reverse of15=51
Sumofitsdigits:6

15 Aram khan
AdvanceWebProgramming

Practical No.2
AIM: Working with Object Oriented C# and ASP .NET
A) Createsimpleapplicationtoperformfollowingoperations.
[i] Finding
FactorialValueCode:-
using [Link];
using [Link];
using [Link];
namespace factorial

{
class Program
{
static void Main(string[] args)
{
int i, number, fact;
[Link]("EntertheNumber");
number = [Link]([Link]());
fact = number;
for (i = number - 1; i >= 1; i--)

15 Aram khan
AdvanceWebProgramming
{
fact = fact * i;
}
[Link]("\nFactorialofGivenNumberis:"+fact);
[Link]();

}
}
}
Output:
Enter the number:-6
Factorial of given number is.:- 720

15 Aram khan
AdvanceWebProgramming
[ii] MoneyConversion:
Codes: -
using System;
using [Link];
[Link];

[Link];
namespace CurrencyConversion
{
class Program
{
static void Main(string[] args)
{
int choice;
[Link](&quot;EnteryourChoice:\n1-DollartoRupee\n2-
EurotoRupee\n3-Malaysian
Ringgit to Rupee&quot;);
choice = [Link]([Link]());
switch (choice)

15 Aram khan
AdvanceWebProgramming

case 1:
Double dollar, rupee, val;
[Link](&quot;EntertheDollarAmount:&quot;);
dollar = [Link]([Link]());
[Link](&quot;Enter the Dollar Value :&quot;);
val =[Link]([Link]());
rupee = dollar *val;
[Link](&quot;{0}DollarEquals{1}Rupees&quot;,dollar, rupee);
break;
case2:

Double Euro, rupe, valu;


[Link](&quot;EntertheEuroAmount:&quot;);
Euro = [Link]([Link]());
[Link](&quot;Enter the Euro Value :&quot;);
valu =[Link]([Link]());
rupe = Euro * valu;
[Link](&quot;{0}EuroEquals{1}Rupees&quot;,Euro,rupe); break;

15 Aram khan
AdvanceWebProgramming
case 3:
Double ringit, rup, value;
[Link](&quot;EntertheRinggitAmount:&quot;);
ringit = [Link]([Link]());
[Link](&quot;Enter the Ringgit Value :&quot;);
value =[Link]([Link]());
rup = ringit * value;
[Link](&quot;{0}MalaysianRinggitEquals{1}Rupees&quot;, ringit,
rup);

break;
}
[Link]();
}
}
}
2) A) [ii]Output:

15 Aram khan
AdvanceWebProgramming

15 Aram khan
AdvanceWebProgramming
[iii] Quadratic
EquationCodes:-
using System;
namespace example
{
class Quadraticroots
{
double a, b, c;
public void read()

{
[Link]("\n Tofindtherootsofaquadraticequationof
the form a*x*x + b*x + c = 0");
[Link]("\nEntervaluefora:"); a
= [Link]([Link]());
[Link]("\nEntervalueforb:"); b
= [Link]([Link]());
[Link]("\nEntervalueforc:");
c=[Link]([Link]());
}

15 Aram khan
AdvanceWebProgramming
public void compute()
{
int m;
double r1, r2, d1;
d1=b*b-4*a*c; if (a
==0)
m = 1;
elseif(d1>0)
m =2;
elseif(d1==0)
m =3;

else
m = 4;
switch(m)
{
case1:[Link]("\nNotaQuadraticequation,Linear
equation");
[Link]();
break;

15 Aram khan
AdvanceWebProgramming
case2:[Link]("\nRootsareRealandDistinct");
r1=(-b+[Link](d1))/(2*a);
r2 = (-b - [Link](d1)) / (2 * a);
[Link]("\nFirstrootis{0:#.##}",r1);
[Link]("\nSecondrootis{0:#.##}",r2);
[Link]();
break;
case3:[Link]("\nRootsareRealandEqual");
r1=r2=(-b)/(2*a);
[Link]("\nFirstrootis{0:#.##}",r1);
[Link]("\nSecondrootis{0:#.##}",r2);
[Link]();

break;
case4:[Link]("\nRootsareImaginary");
r1 = (-b) / (2 * a);
r2 = [Link](-d1) / (2 *a);
[Link]("\nFirstrootis{0:#.##}+i{1:#.##}",r1,r2);
[Link]("\nSecondrootis{0:#.##}-i{1:#.##}",r1, r2);

15 Aram khan
AdvanceWebProgramming
[Link]();
break;
}
}
}
class Roots
{
public static voidMain()
{
Quadraticrootsqr=newQuadraticroots();
[Link]();

[Link]();
}
}
}
2)A) [iii] Output: -

15 Aram khan
AdvanceWebProgramming
[iv] Temperature
ConversionCode:-
using System;
using [Link];
[Link];

[Link];
namespace temperatureconversion
{
class Program
{
static void Main(string[] args)
{
int celsius, faren;
[Link]("EntertheTemperatureinCelsius(°C):");
celsius = [Link]([Link]());
faren = (celsius * 9) / 5 + 32;

[Link]("0TemperatureinFahrenheitis(°F):"+faren);
[Link]();
}

15 Aram khan
AdvanceWebProgramming
}
}

2) A) [iv] Output:-

15 Aram khan
AdvanceWebProgramming
B) Createsimpleapplicationtodemonstrateuseoffollowingconcepts.
[i] Function
OverloadingCode:-
using System;
namespaceswap

{
classOverloading
{
public void swap(ref int n, ref int m)
{
int t;
t =n;
n =m;
m =t;
}
public void swap(ref float f1, ref float f2)
{
floatf;
f = f1;

15 Aram khan
AdvanceWebProgramming
f1 = f2;
f2 =f;
}
}
class program
{
static void Main(string[] args)
{
Overloading objOverloading = new Overloading();
int n = 10, m = 20;
[Link](ref n, ref m);
[Link]("N="+n+"\tM="+m);
float f1 = 10.5f, f2 = 20.6f;
[Link](ref f1, ref f2);
[Link]("F1="+f1+"\tF2="+f2);
}
}
}

15 Aram khan
AdvanceWebProgramming
OUTPUT:
N=20 M=10
F1=20.6 F2=10.5

15 Aram khan
AdvanceWebProgramming
[ii] Inheritance
(a) Single Inheritance
Writeaprogramtoimplementsingleinheritancefromfollowing
figure. Accept and display data for one table.
CODE:
[Link]
using System;

namespace SingleInheritance
{
class Furniture
{
string material;
float price;

public void getdata()


{
[Link]("Enter material : ");
material = [Link]();
[Link]("Enter price : ");
price = [Link]([Link]());

15 Aram khan
AdvanceWebProgramming
}
public void showdata()
{
[Link]("Material:"+material);
[Link]("Price : " + price);

}}}
[Link]
using System;
namespace SingleInheritance
{
class Table:Furniture
{
int height, surface_area;
public voidgetdata()
{
[Link]();
[Link]("Enter height: ");
height = [Link]([Link]());
[Link]("Enter surface area: ");

15 Aram khan
AdvanceWebProgramming
surface_area = [Link]([Link]());
}
public void showdata()
{
[Link]();
[Link]("Height :"+height);
[Link]("Surface Area : " +surface_area);
}}}
[Link]
using System;
namespace SingleInheritance
{
class Program
{
static void Main(string[] args)
{
Tablet1=newTable();
[Link]();
[Link]();

15 Aram khan
AdvanceWebProgramming
}}}
OUTPUT:
Entermaterial:wood
Enter price : 1220
Enter height: 35
Entersurfacearea:26
Material :wood

Price : 1220
Height : 35
SurfaceArea:26

15 Aram khan
AdvanceWebProgramming
[ii](b) Multiple inheritance
CODE:
[Link]
using System;
namespace MultipleInheritance
{
interface Gross
{
int ta
{
get;
set;
}
int da
{
get;
set;
}
int GrossSal();

15 Aram khan
AdvanceWebProgramming
}}
[Link]
using System;

namespace MultipleInheritance
{
class Employee
{
string name;
public Employee(string name)
{ [Link] = name; }
public int BasicSal(int basicSal)
{ return basicSal; }
public void ShowData()

{
[Link]("Name : " + name);
}}}
[Link]
using System;

namespace MultipleInheritance

15 Aram khan
AdvanceWebProgramming
{
class Salary:employee,Gross
{
int hra;
public Salary(string name, int hra):base(name)
{[Link]=hra;}
public intta

{
get {return S_ta; }
set { S_ta = value; }
}
private intS_ta;
public int da

{
get{returnS_da;}
set{S_da=value;}

}
private int S_da;
public intGrossSal()

15 Aram khan
AdvanceWebProgramming
{
int gSal;
gSal=hra+ta+da+BasicSal(15000);
returngSal;
}
public void dispSal()
{ [Link]();
[Link]("Gross Sal : " +GrossSal());
}}}
[Link]
using System;

namespace MultipleInheritance
{
class Program
{
static void Main(string[] args)
{
Salary s = new Salary("Prachit", 35000);
[Link] = 20000;

15 Aram khan
AdvanceWebProgramming
[Link] = 30000;
[Link]();
}}}
OUTPUT:
Name :Prachit
Gross Sal:100000

15 Aram khan
AdvanceWebProgramming
(ii)[c] Hierarchical Inheritance
CODE:
[Link]
using System;
namespace HeirarchicalInheritance
{
class employee
{
public virtual void display()
{
[Link]("Display of employee class called ");
}}}
[Link]
using System;
namespace HeirarchicalInheritance
{
class Programmer:employee
{
public void display()

15 Aram khan
AdvanceWebProgramming
{
[Link](" Display of Programmer class called ");
}}}
[Link]
using System;

namespace HeirarchicalInheritance
{
class Manager
{
public void display()
{
[Link]("Display of manager class called ");
}}}
[Link]
using System;
namespace HeirarchicalInheritance
{
class Program
{

15 Aram khan
AdvanceWebProgramming
static void Main(string[] args)
{
Programmer objProgrammer;
Manager objManager;
[Link]("Whosedetailsyouwanttousetosee\n
[Link] \n
[Link]");
int choice=[Link]([Link]());
if(choice==1)

{
objProgrammer=new Programmer();
[Link]();
}
else if(choice==2)
{
objManager=newManager();
[Link]();
}
else

15 Aram khan
AdvanceWebProgramming
{
[Link]("Wrong choiceentered");
}}}}
OUTPUT:
Whosedetailsyouwanttousetosee
[Link]
2.Manager1
Display of Programmer class called
Whosedetailsyouwanttousetosee
[Link]
2.Manager2
Display of manager class called
Whosedetailsyouwanttousetosee
[Link]
2.Manager6
Wrong choice entered

15 Aram khan
AdvanceWebProgramming
(ii)[d] Multilevel Inheritance
Codes: -
[Link]
using System;
namespace multilevelinheritance
{
class Result:Test
{
int total;
public Result(int roll_no, string name, int marks1, int marks2)
: base(roll_no, name, marks1, marks2)
{
total = getMarks1() +getMarks2();
}
public void display()
{
[Link]();
[Link]("Total: " + total);

}}}

15 Aram khan
AdvanceWebProgramming
[Link]
using System;
namespace multilevelinheritance
{
class Test:student
{
int marks1, marks2;
public Test(int roll_no, string name, int marks1, int marks2)
: base(roll_no, name)
{
this.marks1 = marks1;
this.marks2 = marks2;
}
public int getMarks1()
{
return marks1;
}
public int getMarks2()
{

15 Aram khan
AdvanceWebProgramming
return marks2;
}
public void dispaly()
{
[Link]();
[Link]("Marks1: " + marks1);
[Link]("Marks2: " + marks2);

}}}
[Link]
using System;
namespace multilevelinheritance
{
class student
{
int roll_no;
string name;

public student(int roll_no, stringname)


{
this.roll_no = roll_no;

15 Aram khan
AdvanceWebProgramming
[Link] = name;
}
public student() { }
public void display()
{
[Link]("Rollno:"+roll_no);
[Link]("Name: " + name);

}}}
[Link]
using System;
namespace multilevelinheritance
{
class Program
{
static void Main(string[] args)
{
Resultr1=newResult(101,"Prachit",50,70);
[Link]();

}}}

15 Aram Khan
AdvanceWebProgramming
OUTPUT:
Roll no: 101
Name: Prachit
Marks1:50
Marks2: 70
Total: 120

15 Aram Khan
AdvanceWebProgramming
[iii] Constructor
OverloadingCodes:-
[Link]
using System;
namespace SalaryConstructure
{
class Salary
{
intbasic,ta,da,hra;
publicSalary()
{
da = 9000;
hra = 6000;
}
public void getdata()
{
[Link]("Enterbasicsalary:");
basic = [Link]([Link]());

[Link]("Enter travelling allowance : ");

15 Aram Khan
AdvanceWebProgramming
ta = [Link]([Link]());
}
public void showdata()
{
[Link]("Basic salary : " + basic);
[Link]("Dearness allowence : " + da);
[Link]("Housing rent allowence : " + hra);
[Link]("Travelling allowence : " + ta);
[Link]("GrossSalary:"+(basic+da+hra+ta));

}}}
[Link]
using System;
namespace SalaryConstructure
{
class Program
{
static void Main(string[] args)
{
Salary s = newSalary();

15 Aram Khan
AdvanceWebProgramming
[Link]();
[Link]();
}}}
OUTPUT:
Enter basic salary : 52000
Entertravellingallowance:3000
Basic salary :52000
Dearness allowence : 9000
Housing rent allowence : 6000
Travelling allowence : 3000
Gross Salary : 70000

15 Aram Khan
AdvanceWebProgramming
(iv)
InterfacesCode
s: -
[Link]
using System;
using [Link];
using [Link];
using [Link];
namespaceInterFaceDemo{
interface IOne{
void ONE(); //Pure Abstract Method Signature
}
interface ITwo {
void TWO();

}
interface IThree: IOne {
void THREE();

}
interface IFour {
void FOUR();

15 Aram Khan
AdvanceWebProgramming
}
interfaceIFive:IThree{
voidFIVE();

}
interface IEVEN: ITwo, IFour {}
classODDEVEN:IEVEN,IFive//MustImplementalltheabstractmethod, in
Derived class.
{
public void ONE() //Implementation of Abstract Method.
{
[Link]("This is ONE");
}
public void TWO() {
[Link]("This is TWO");

}
public void THREE() {
[Link]("This is THERE");
}

15 Aram Khan
AdvanceWebProgramming
public void FOUR() {
[Link]("This is FOUR");
}
public void FIVE() {
[Link]("This is FIVE");

}
}
}
[Link]
using System;
using [Link];
using [Link];
using [Link];
namespaceInterFaceDemo{
class Program{
static void Main(string[] args) {
[Link]("This is ODD");
IFive obj1 = new ODDEVEN();
[Link]();

15 Aram Khan
AdvanceWebProgramming
[Link]();
[Link]();
[Link]("\n\nThis is EVEN");
IEVEN obj2 = new ODDEVEN();
[Link]();
[Link]();
[Link]();
}
}
}
(iv)output-interface

15 Aram Khan
AdvanceWebProgramming
(C) Createsimpleapplicationtodemonstrateuseoffollowingconcepts
[i] Using Delegates
andeventsCodes:-
[Link]
using System;

namespace TrafficDelegateExample
{
publicdelegatevoidTrafficDel();
classTrafficSignal

{
public static voidYellow()
{
[Link]("Yellow light signals to get ready");
}
public static voidGreen()
{
[Link]("Green light signals to go");
}
public static voidRed()

15 Aram Khan
AdvanceWebProgramming
{
[Link]("Red light signals to stop");
}
TrafficDel[]td=newTrafficDel[3];
public voidIdentifySignal()

{
td[0] = new TrafficDel(Yellow);
td[1] = new TrafficDel(Green);
td[2]=newTrafficDel(Red);
}
public void display()
{td[0]
();

td[1]();
td[2]();
}
}}
[Link]
using System;

15 Aram Khan
AdvanceWebProgramming
namespace TrafficDelegateExample
{
class Program
{
static void Main(string[] args)
{
TrafficSignal ts = new TrafficSignal();
[Link]();
[Link]();
}}}
OUTPUT:
Yellowlightsignalstogetready
Green light signals to go

Red light signals to stop

15 Aram Khan
AdvanceWebProgramming
[ii] Exception
handlingCodes: -
[Link]
usingSystem;
namespace ExceptionHandlingExample
{
class NotEvenException:Exception
{
public NotEvenException(string msg)
: base(msg)
{
}
}}
[Link]
using System;
namespace ExceptionHandlingExample
{
class Program
{

15 Aram Khan
AdvanceWebProgramming
static void Main(string[] args)
{
int num;
try
{
[Link]("Enter a number: ");
num = [Link]([Link]());
if((num%2)!=0)thrownewNotEvenException("Notanevennumber"); else

[Link]("Its even number ");


}
catch (NotEvenException e) { [Link]([Link]); }
}}}
OUTPUT:
Enter a number: 5
Notanevennumber

15 Aram Khan
AdvanceWebProgramming

Practical No.3
AIM: - Working with Web Forms and Controls.
A) DemonstratetheuseofCalendarcontroltoperformF
ollowingoperations.
a) Displaymessagesinacalendarcontrol
b) Displayvacationinacalendarcontrol
c) Selecteddayinacalendarcontrolusingstyle
d) Difference between twocalendardates
Calenderpropertiessetforthisexample:

Codes: -
<asp:Calendar ID="Calendar1" runat="server" BackColor="#FFFFCC"
BorderColor="#FFCC66" BorderWidth="1px"
DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt"
ForeColor="#663399" Height="200px"
NextPrevFormat="ShortMonth" OnDayRender="Calendar1_DayRender"
ShowGridLines="True" Width="300px"
OnSelectionChanged="Calendar1_SelectionChanged" >
<DayHeaderStyle BackColor="#FFCC66" Font-Bold="True" Height="1px"
/>

15 Aram Khan
AdvanceWebProgramming
<NextPrevStyle BorderStyle="Solid" BorderWidth="2px" Font-Size="9pt"
ForeColor="#FFFFCC" />
<OtherMonthDayStyle BackColor="#FFCC99" BorderStyle="Solid"
ForeColor="#CC9966" />
<SelectedDayStyle BackColor="Red" Font-Bold="True" />
<SelectorStyle BackColor="#FFCC66" />
<TitleStyle BackColor="#990000" Font-Bold="True" Font-Size="9pt"
ForeColor="#FFFFCC" />
<TodayDayStyleBackColor="#FFCC66"ForeColor="White"/>
<WeekendDayStyle Height="50px" />
</asp:Calendar>
[Link]
protected void btnResult_Click(object sender, EventArgs e)
{
[Link] = "SAMBARE";
[Link] = [Link];
[Link] = [Link];
[Link] =[Link];

[Link]="TodaysDate"+[Link]();

15 Aram Khan
AdvanceWebProgramming
[Link] = "Ganpati Vacation Start: 9-13-2018";
TimeSpand=newDateTime(2018,9,13)-[Link];
[Link] = "Days Remaining For Ganpati Vacation:"+[Link]();
TimeSpan d1 = new DateTime(2018, 12, 31) - [Link];
[Link] = "Days Remaining for New Year:"+[Link]();
if ([Link]() == "9-13-2018")
[Link] = "<b>Ganpati Festival Start</b>";
if ([Link]() == "9-23-2018")
[Link] = "<b>Ganpati Festival End</b>";

}
protectedvoidCalendar1_DayRender(objectsender,
[Link] e)
{
if([Link]==5&&[Link]==9)
{
[Link] = [Link];
Label lbl = newLabel();
[Link] = "<br>Teachers Day!";
[Link](lbl);

15 Aram Khan
AdvanceWebProgramming
Imageg1=newImage();
[Link] = "[Link]";
[Link] = 20;
[Link] = 20;
[Link](g1);

}
if ([Link] == 13 && [Link] == 9)
{
[Link] = new DateTime(2018, 9, 12);
[Link]([Link],
[Link](10));
Labellbl1=newLabel();
[Link] = "<br>Ganpati!";
[Link](lbl1);
}
}
protected void btnReset_Click(object sender, EventArgs e)
{
[Link] = "";

15 Aram Khan
AdvanceWebProgramming
[Link] ="";
[Link] ="";
[Link] ="";
[Link] ="";
[Link]();
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
[Link] = "Your Selected Date:" +
[Link]();
}
3) A) OUTPUT:-

15 Aram Khan
AdvanceWebProgramming
B) DemonstratetheuseofTreeviewcontrolperformfollowingoperations.
a)Treeviewcontrolanddatalistb)Treeview
operations Add XMLFile

Website->Add->XMLFileandNameit‘stdetail’.
[Link]
<?xml version="1.0" encoding="utf-8"?>
<studentdetail>
<student>
<sid>1</sid>
<sname>Tushar</sname>
<sclass>TYIT</sclass>
</student>
<student>
<sid>2</sid>
<sname>Sonali</sname>
<sclass>TYCS</sclass>
</student>
<student>
<sid>3</sid>

15 Aram Khan
AdvanceWebProgramming
<sname>Yashashree</sname>
<sclass>TYIT</sclass>
</student>
<student>
<sid>4</sid>
<sname>Vedshree</sname>
<sclass>TYCS</sclass>
</student>
</studentdetail>
[Link]
<form id="form1" runat="server">
<div>
Treeviewcontrolnavigation:<asp:TreeViewID="TreeView1"runat=
"server" Width=
"150px" ImageSet="Arrows">
<HoverNodeStyle Font-Underline="True" ForeColor="#5555DD" />
<Nodes>
<asp:TreeNode Text = "[Link] Practs" Value = "New Node">
<asp:TreeNode Text = "Calendar Control" Value = "RED"

15 Aram Khan
AdvanceWebProgramming
NavigateUrl="~/[Link]">
</asp:TreeNode>
<asp:TreeNodeText="ConstructorOverloading"Value="GREEN"
NavigateUrl="~/[Link]"></asp:TreeNode>
<asp:TreeNode NavigateUrl="~/[Link]" Text="Inheritance"
Value="BLUE"></asp:TreeNode>
<asp:TreeNode NavigateUrl="~/[Link]" Text="Class Properties"
Value="Class
Properties"></asp:TreeNode>
</asp:TreeNode>
</Nodes>
<NodeStyleFont-Names="Tahoma"Font-Size="10pt"ForeColor="Black"
HorizontalPadding="5px" NodeSpacing="0px" VerticalPadding="0px"/>

<ParentNodeStyle Font-Bold="False" />


<SelectedNodeStyle Font-Underline="True" ForeColor="#5555DD"
HorizontalPadding="0px" VerticalPadding="0px" />

</asp:TreeView>
<br />
Fetch Datalist Using XML data : </div>

15 Aram Khan
AdvanceWebProgramming
<asp:DataList ID="DataList1" runat="server">
<ItemTemplate>
<table class = "table"border="1">
<tr>
<td>RollNum:<%#Eval("sid")%><br/>
Name : <%# Eval("sname") %><br />
Class : <%#Eval("sclass")%>

</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
OUTPUT

15 Aram Khan
AdvanceWebProgramming

15 Aram Khan
AdvanceWebProgramming
[Link]
using [Link];
public partial class _Default :[Link]
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindData();
}
}
protected void BindData()
{
DataSet ds = new DataSet();
[Link]([Link]("[Link]"));
if(ds!=null&&[Link]())

{
[Link] = ds;
[Link]();

15 Aram Khan
AdvanceWebProgramming
}
else
{
[Link]();
}
}
}
3)B) b) OUTPUT:-

15 Aram Khan
AdvanceWebProgramming

Practical No.4
AIM: Working with form controls
A) [Link]
de:
XML File
<Advertisements>
<Ad>
<ImageUrl>[Link]</ImageUrl>
<NavigateUrl>[Link]
<AlternateText>
Order flowers, roses, gifts and more
</AlternateText>
<Impressions>20</Impressions>
<Keyword>flowers</Keyword>
</Ad>
<Ad>
<ImageUrl>[Link]</ImageUrl>
<NavigateUrl>[Link]
<AlternateText>Order roses and flowers</AlternateText>

15 Aram Khan
AdvanceWebProgramming
<Impressions>20</Impressions>
<Keyword>gifts</Keyword>
</Ad>
<Ad>
<ImageUrl>[Link]</ImageUrl>
<NavigateUrl>[Link]
<AlternateText>Send flowers to Russia</AlternateText>
<Impressions>20</Impressions>
<Keyword>russia</Keyword>
</Ad>
</Advertisements>
[Link]
<asp:AdRotator ID="AdRotator1" runat="server"
DataSourceID="XmlDataSource1" />
<asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="~/[Link]"></asp:XmlDataSource>
OUTPUT:

15 Aram Khan
AdvanceWebProgramming

15 Aram Khan
AdvanceWebProgramming
B) CreatewebformtodemonstrateuseUserControls.C
odes:-
[Link]
<%@ Control Language="C#" AutoEventWireup="true"
CodeFile="[Link]" 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>

15 Aram Khan
AdvanceWebProgramming
<td>
</td>
</tr>
<tr>
<td></td>
<td>
<asp:Button ID="txtSave" runat="server" Text="Save"
onclick="txtSave_Click" />
</td>
</tr>
</table><br/>
<asp:Label ID="Label1" runat="server" ForeColor="White" Text="
"></asp:Label>

[Link]
protected void txtSave_Click(object sender, EventArgs e)
{
[Link]="YourNameis"+[Link]+"andyouarefrom"+
[Link];

15 Aram Khan
AdvanceWebProgramming
[Link]
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="[Link]"Inherits="UserControlDisplay"

%>
<%@ Register Src="~/[Link]" TagPrefix="uc"
TagName="Student"%>
<!DOCTYPE html>
<html xmlns="[Link]
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<uc:Student ID="studentcontrol" runat="server"/>
</div>
</form>
</body>
</html>

15 Aram Khan
AdvanceWebProgramming
OUTPUT:

15 Aram Khan
AdvanceWebProgramming

Practical No.5
AIM: - Working with Navigation, Beautification and Master page
A)CreateawebapplicationtodemonstrateuseofMasterPagewith
applyingStylesandThemesforpagebeautification.
Codes: -
[Link]
<%@ Master Language="C#" AutoEventWireup="true"
CodeFile="[Link]"
Inherits="MasterPage" %>
<!DOCTYPE html>
<html xmlns="[Link]
<head runat="server">
<title>Master Page Demo</title>
<link href="css/[Link]" rel="stylesheet"/>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
<style type="text/css">
.auto-style1 {
position: absolute;

15 Aram Khan
AdvanceWebProgramming
top: 373px;
left: 1028px;
bottom: 303px;
}
.auto-style2 {
position: absolute;
top: 537px;
left: 1016px;
z-index: 1;

}
</style>
</head>
<body>
<!DOCTYPE html>
<form id="form1" runat="server">
<html>
<head>
<title>Master</title>
<link rel="stylesheet" type="text/css" href="[Link]">

15 Aram Khan
AdvanceWebProgramming
</head>
<body>
<header id="header">
<h1>Demo Of MasterPage</h1>
</header>
<nav id="nav">
<ul>
<li><a href="[Link]">Insight</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Downloads</a></li>
<li><a href="#">ContactUs</a></li>
</ul>
</nav>
<aside id="side">
<h1>Info</h1>
<a href="#"><p>Product Type 1</p></a>
<a href="#"><p>Product Type 2</p></a>
<ahref="#"><p>ProductType3<ahref="#"><asp:ScriptManager
ID="ScriptManager1"

15 Aram Khan
AdvanceWebProgramming
runat="server">
</asp:ScriptManager>
</a>
</p>
<asp:Button ID="Button2" runat="server" CssClass="auto-style1"
style="z-index:1"
Text="Button"/>
<asp:Button ID="Button1" runat="server" CssClass="auto-style2"
Text="Button"/>

</aside>
<div id="con">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
<footer id="footer">
copyright @Sambare

</footer>
</body>
</html>

15 Aram Khan
AdvanceWebProgramming
</form>
</body>
</html>
[Link]
<%@ Page Title="" Language="C#"
MasterPageFile="~/[Link]"
AutoEventWireup="true" CodeFile="[Link]"
Inherits="MasterDisplay" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head"
runat="server">
</asp:Content>
<asp:Content ID="Content2"
ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

<h1>Home page</h1>
</asp:Content>
[Link]
#header{
color: blueviolet;
text-align: center;

15 Aram Khan
AdvanceWebProgramming
font-size: 20px;
}
#nav{
background-color:darkseagreen;
padding: 5px;

}
ul{
list-style-type: none;
}
li a {
color:crimson ;
font-size: 30px;

column-width: 5%;
}
li
{
display: inline;
padding-left: 2px;
column-width: 20px;

15 Aram Khan
AdvanceWebProgramming
}
a{
text-decoration: none;
margin-left:20px
}
li a:hover{
background-color: aqua;
color:coral ;
padding:1%;
}
#side{
text-align: center;
float: right;
width: 15%;
padding-bottom: 79%;
background-color:#F1FAEE;

}
#article{
background-color: burlywood;

15 Aram Khan
AdvanceWebProgramming
padding: 10px;
padding-bottom:75%;
}
#footer{
background-color: #C7EFCF;
text-align:center;
padding-bottom: 5%;
font-size: 20px;
}
#con{ border:
double;

border-color:burlywood;
}

15 Aram Khan
AdvanceWebProgramming
Practical no 6 :
6a)Createawebapplicationbinddatainamultilinetextboxbyquerying in
another textbox.
[Link] (create a web page with following design): -

[Link]:-
<configuration>
<[Link]>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntimetargetFramework="4.5.2" />
</[Link]>
<connectionStrings>
<add name="connStr"connectionString="Data

15 Aram Khan
AdvanceWebProgramming
Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename='C:\Users\tushars\D
ocumen
ts\Visual Studio
2015\WebSites\Workshop\App_Data\[Link]';Integrated
Security=True" />
</connectionStrings>
</configuration>
[Link]:-
using System;
[Link];
[Link];
[Link];
[Link];
[Link];
[Link];
[Link];
[Link];
public partial class DataBinding :[Link]
{

15 Aram Khan
AdvanceWebProgramming
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
stringconnStr =
[Link]["connStr"].ConnectionStrin
g;
SqlConnection con = new SqlConnection(connStr);
[Link]();
SqlCommandcmd=newSqlCommand([Link],con);
SqlDataReader reader = [Link]();
[Link]();
while ([Link]())
{
//Toaddnewblanklineinthetextarea
for(inti=0;i<[Link]-1;i++)
{
[Link](reader[i].ToString());

15 Aram Khan
AdvanceWebProgramming
}
}
[Link]();
[Link]();
}
}
6a ) output:-

15 Aram Khan
AdvanceWebProgramming
6b)[Link]
[Link](createaweb pagewithfollowingdesign):-

[Link] :-
protected void Button1_Click(object sender, EventArgs e)
{
stringconnStr =
[Link]["connStr"].ConnectionString;
SqlConnection con = new SqlConnection(connStr);
SqlCommandcmd=newSqlCommand("SelectCity,Statefrom
Customer",
con);
[Link]();
SqlDataReader reader = [Link]();
while ([Link]())

15 Aram Khan
AdvanceWebProgramming
[Link] += reader["City"].ToString() + " " +
reader["State"].ToString() +
"<br>";
}
[Link]();
[Link]();
}
6b)output

15 Aram Khan
AdvanceWebProgramming
6 (c):DemonstratetheuseofDatalistlink
[Link]
1. DragtheDatalistcontroltoourwebpageformtoolbox->Data>Datalist.
2. ThenselectChooseDataSourceOptionandselect<NewData
Source>.

3. NowSelectSQLDatabasefromoptionsandClickOkbutton.

4. InnextwindowclickonNewConnectionbutton.
5. InaddconnectionwindowSelecttheavailableSQLServerName

15 Aram Khan
AdvanceWebProgramming
6. KeeptheAuthenticationasWindowsAuthentication.
7. [Link]
selectthedatabasethatwehavecreatedinourapplication.(Usually,itwill
beinDocumentsfolderunderVisualStudio2015/Websites).
8. [Link].
9. ThenClickonOKbutton.

10. OncetheConnectionismadethenclickonNextbuttonfrom
Data SourceWizard.

15 Aram Khan
AdvanceWebProgramming

11. Thenwizardaskforsavingtheconnectionstringinconfigurationfile.
[Link],ifyou
haven’t,[Link].
12. [Link]
wecanchoosethetableaswellasconfiguretheselectstatementaswe
needtodisplaythedataonwebpage.

15 Aram Khan
AdvanceWebProgramming
13. [Link]
Click onfinish.
OUTPUT: -

15 Aram Khan
AdvanceWebProgramming

Practical no. 7
7 (a):CreateawebapplicationtodisplayDatabindingusingDropdownlist
control.
[Link] (create a web page with following design):-
1. CreateawebpagewithDropDownListcontrol,oneButtonand
oneLabel
control.
2. UsecodetobindthedatatoDropDownList.

[Link]:-
usingSystem;
[Link];
[Link];
[Link];
[Link];
[Link];
[Link];

15 Aram Khan
AdvanceWebProgramming
[Link];
[Link];
public partial class DBDropDown : [Link]
{
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack == false)
{
stringconnStr =
[Link]["connStr"].Connecti
onString;
SqlConnection con = new SqlConnection(connStr);
SqlCommandcmd=newSqlCommand("SelectDistinctCity
from Customer",con);
[Link]();
SqlDataReader reader = [Link]();
[Link] = reader;
[Link] = "City";
[Link]();

15 Aram Khan
AdvanceWebProgramming
[Link]();
[Link]();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
[Link]="TheYouHaveSelected:"+[Link];
}}

7 a) Output: -

15 Aram Khan
AdvanceWebProgramming
7(b):Createawebapplicationfortodisplaythephonenoofanauthor
usingdatabase.
[Link] (create a web page with following design):-
CreateawebpagewithDropDownList,ButtonandwithLabelcontrolas
shownbelow.

[Link]:-
usingSystem;
[Link];
[Link];
[Link];
[Link];
[Link];
[Link];
[Link];
[Link];

public partial class PostalCodeByCity : [Link]


{

15 Aram Khan
AdvanceWebProgramming
protected void Button1_Click(object sender, EventArgs e)
{
[Link] = [Link];
}
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack == false)
{
stringconnStr =
[Link]["connStr"].Connecti
onString;
SqlConnection con = new SqlConnection(connStr);
SqlCommandcmd = new SqlCommand("Select Distinct
POSTAL_CODE from Customer", con);
[Link]();
SqlDataReader reader = [Link]();
[Link] = reader;
[Link] = "City"; [Link]
= "POSTAL_CODE"; [Link]();

15 Aram Khan
AdvanceWebProgramming
[Link]();
[Link]();
}
}
}
7b) Output: -

15 Aram Khan
AdvanceWebProgramming
7(c):Createawebapplicationforinsertinganddeletingrecordfroma
database. (Using Execute-NonQuery).
[Link] (create a web page with following design): -

[Link]:-
usingSystem;
[Link];
[Link];
[Link];
[Link];
[Link];
[Link];
[Link];

15 Aram Khan
AdvanceWebProgramming
public partial class ExecuteNonQuery : [Link]
{
protected void Button1_Click(object sender, EventArgs e)
{
stringconnStr =
[Link]["connStr"].ConnectionStrin
g;SqlConnectioncon=newSqlConnection(connStr);
stringInsertQuery="insertintoBRANCHvalues(@ADDRESS,@CITY,
@NAME, @STATE,@ZIP_CODE)";
SqlCommandcmd = new SqlCommand(InsertQuery, con);
[Link]("@ADDRESS", [Link]);
[Link]("@CITY", [Link]);
[Link]("@NAME", [Link]);
[Link]("@STATE", [Link]);
[Link]("@ZIP_CODE", [Link]);
[Link]();

[Link]();
[Link] = "Record Inserted Successfuly.";
[Link]();

15 Aram Khan
AdvanceWebProgramming
}
protected void Button2_Click(object sender, EventArgs e)
{
stringconnStr =
[Link]["connStr"].ConnectionStrin
g; SqlConnection con = new SqlConnection(connStr);
stringInsertQuery="deletefrombranchwhereNAME=@NAME";
SqlCommandcmd = new SqlCommand(InsertQuery, con);
[Link]("@NAME", [Link]);
[Link]();

[Link]( );
[Link] = "Record Deleted Successfuly.";
[Link]( ); } }

15 Aram Khan
AdvanceWebProgramming

Practical no.8
8)a)Aim:CreateawebapplicationtodemonstrateVarioususesand
properties of SQL Data Source.
1. File new website empty website name itok
2. Rightclickonwebsitemadeaddnewitemsqlserverdatabasename it
addyes
3. RightclickontableInserverexploreraddnewtableadd
columns save thetable
4. Rightclickontablemade showtabledataaddvalues
5. Rightclickonwebsiteaddnewitemwebformnameit
6. Gotodesignviewaddformforlogin
7. Add sqldatasource configureit
8. Writecode

15 Aram Khan
AdvanceWebProgramming
CODE:
[Link]
usingSystem;
using [Link];
using [Link];
using [Link];
using [Link];

using [Link];
publicpartialclassLoginModule:[Link]
{
protectedvoidPage_Load(objectsender,EventArgse)
{
}
protected void btnSignUp_Click(object sender, EventArgs e)
{
[Link]["Username"].DefaultValue =
[Link];
[Link]["Password"].DefaultValue =
[Link];

15 Aram Khan
AdvanceWebProgramming
[Link]();
[Link]="UserAdded";
}
}
OUTPUT:

15 Aram Khan
AdvanceWebProgramming
8)b)CreateawebapplicationTodemonstratedatabindingusing
DetailsView and FormViewcontrol.
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
namespace WebApplication1

{
public partial class WebForm1 :[Link]
{
SqlDataAdapterda=newSqlDataAdapter();
SqlConnectioncon=newSqlConnection();
SqlCommandcmd=newSqlCommand();
DataSetds=newDataSet();
string str;

15 Aram Khan
AdvanceWebProgramming
protected void Page_Load(object sender, EventArgs e)
{
[Link] = "Data
Source=(LocalDB)\\v11.0;AttachDbFilename=C:\\Users\\SAHIL\\Document
s\\Stud
[Link];Inte
grated Security=True;Connect Timeout=30";
[Link]();
[Link]="ConnectedToServer";
[Link]();

}
protected void Button1_Click(object sender, EventArgs e)
{
str="insertintostud_mastvalues("+[Link]+",'"+
[Link] + " ',
"+
[Link]+")";
[Link]();

cmd = newSqlCommand(str,con);

15 Aram Khan
AdvanceWebProgramming
[Link]();
[Link]();
[Link]="SaveSuccessfull";
[Link] = " ";
[Link] = " ";
[Link] = "";
}
protectedvoidDropDownList1_SelectedIndexChanged(objectsender,
EventArgs
e)

{
}
protected void Button4_Click(object sender, EventArgs e)
{
str="select*fromstud_mastwherestud_id="+[Link]+" ";
da=newSqlDataAdapter(str,con);
ds = new DataSet();
[Link](ds,"stud_mast");

15 Aram Khan
AdvanceWebProgramming
[Link] = [Link]["stud_mast"].Rows[0]["stud_id"].ToString();
[Link] = [Link]["stud_mast"].Rows[0]["stud_name"].ToString();
[Link] = [Link]["stud_mast"].Rows[0]["phn_no"].ToString();
}
protected void Button2_Click(object sender, EventArgs e)
{
str="updatestud_mastsetstud_name='"+[Link]+"',
phn_no="
+[Link]+" where stud_id= "+[Link]+" ";
[Link]();
cmd=newSqlCommand(str,con);
[Link]();
[Link]();
[Link] = " Update Successfull ";
}
protected void Button3_Click(object sender, EventArgs e)
{
str="deletefromstud_mastwherestud_id="+[Link]+"";
[Link]();

15 Aram Khan
AdvanceWebProgramming
cmd=newSqlCommand(str,con);
[Link]();
[Link]();
[Link] = " Update Successfull ";
}}}
Output: -

15 Aram Khan
AdvanceWebProgramming

Practical no.9
Aim:-CreateawebapplicationtodemonstrateuseofGridView button
column and GridViewevents.
Grid_view.aspx:-

Grid_view.[Link]:-
using System;
[Link];
[Link];
[Link];
[Link];
[Link];
[Link];
public partial class grid_view :[Link]
{

15 Aram Khan
AdvanceWebProgramming
protected void Page_Load(object sender, EventArgs e)
{
}
protected void GridView1_RowCommand(object sender,
GridViewCommandEventArgs e)

{
if ([Link] == "b1")
{
[Link]([Link]);
[Link]=[Link];
[Link][Convert.ToInt16([Link])].BackColor =
[Link];
}
}
}
OUTPUT: -

10a)output:-

15 Aram Khan
AdvanceWebProgramming

Practical no.10
10a)Aim:-Createawebapplicationtodemonstratereadingandwriting
operation with XML.
[Link]:-

[Link]:-
usingSystem;
[Link];
[Link];
[Link];
[Link];
[Link];
[Link];
public partial class _Default :[Link]
{
protected void Button1_Click(object sender, EventArgs e)
{

15 Aram Khan
AdvanceWebProgramming
XmlReaderred=[Link](@"C:\Users\Admin\Documents\
VisualStudio
2010\WebSites\WebSite24\[Link]");
while ([Link]())

{
if ([Link]([Link]))
{
string s = [Link] + "";
[Link]=s+[Link];
}
}
[Link]();
}
protected void Button2_Click(object sender, EventArgs e)
{
XmlWriterSettings set = new XmlWriterSettings();
[Link] = true;
XmlWriterwr = [Link](@"C:\Users\Admin\Documents\Visual
Studio

15 Aram Khan
AdvanceWebProgramming
2010\WebSites\WebSite24\[Link]",set);
[Link]();
[Link]("EXAMPLE OF WRITE A XML DOCUMENT");
[Link]("student");
[Link]();

}
}
OUTPUT: -

15 Aram Khan
AdvanceWebProgramming

Practical No. 11
Aim:-ProgramstocreateanduseDLL
[Link]:-
using System;
[Link];
[Link];
[Link];

namespace ClassLibrary5
{
publicclassClass1
{
publicint add(int a, int b)
{
intc=a+b;
returnc;

}
}
}
[Link]:-

15 Aram Khan
AdvanceWebProgramming
using System;
[Link];
[Link];
[Link];
namespace ConsoleApplication5
{
classProgram
{
staticvoid Main(string[] args)
{
ClassLibrary5.Class1 c = newClassLibrary5.Class1();
int t = [Link](1, 2);
[Link]("addition={0}",t);
[Link]();
}
}
}

15 Aram Khan
AdvanceWebProgramming
Output: -

15 Aram Khan

You might also like