0% found this document useful (0 votes)
136 views75 pages

Awp Practical

awp pract

Uploaded by

Jisha Marathe
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)
136 views75 pages

Awp Practical

awp pract

Uploaded by

Jisha Marathe
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
You are on page 1/ 75

TYBSC.

IT ADVANCED WEB PROGRAMMING

PRACTICAL NO. 1
1a).AIM: Create an application to print on screen the output of adding,
subtracting, multiplying and dividing two numbers entered by the user
in C#.

Code Source:
using System;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int a, b, c, d, e,f;
Console.WriteLine(“Enter the 2 numbers”;);
a = Convert.ToInt32(Console.ReadLine());
b = Convert.ToInt32(Console.ReadLine());
c=a-b;
d=a+b;
e=a*b;
f=a/b;
Console.WriteLine(“Subtraction Result”+c);
Console.WriteLine(“Addition Result”+d);
Console.WriteLine(“Product Result”+e);
Console.WriteLine(“Division Result”+f);

Console.ReadKey();
}
}}

Name: Anuj Yadav [1] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Output:

Name: Anuj Yadav [2] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

1b).AIM: Create an application to print Floyd’s triangle till n rows in C#.

Code Source:
using System;
class GFG
{
static void printFloydTriangle(int n)
{
int i, j, val = 1;
for (i = 1; i <= n; i++)
{
for (j = 1; j <= i; j++)
{
Console.Write(val + " ");
val++;
}
Console.WriteLine();
}
}

// Driver Code
public static void Main()
{
printFloydTriangle(6);
}
}

Name: Anuj Yadav [3] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Output:

Name: Anuj Yadav [4] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

1c) i. AIM: Create an application to demonstrate following operations


i.Generate Fibonacci series. ii.Test for prime number.

Code Source:
using System;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
int num1=0,num2=1,num3,num4,num,counter;
Console.Write ("Upto how many number you want fibonacci
series:");
num=int.Parse(Console.ReadLine());
counter=3;
Console.Write(num1+"\t"+num2);
while(counter<=num)
{
num3 = num1 + num2;
if (counter >= num)

break;
Console.Write("\t" + num3);
num1 = num2;
num2 = num3;
counter++;
}
}}}

Name: Anuj Yadav [5] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Output:

Name: Anuj Yadav [6] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

ii:)Test for Prime numbers.


Code Source:
Using System;
Namespace Testprime
{
Class Program
{
static void Main(string[] args)
{
int num, counter;
Console.Write("Enter number:");
num = int.Parse(Console.ReadLine());
for (counter = 2; counter <= num / 2; counter++)
{
if ((num % counter) == 0)
break;
}
if (num == 1)
Console.WriteLine(num + "is neither prime nor
composite");
else if(counter<(num/2))
Console.WriteLine(num+"is not prime number");
else
Console.WriteLine(num+"is prime number");
}
}
}

Name: Anuj Yadav [7] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Output:

Name: Anuj Yadav [8] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

PRACTICAL NO. 2
2a.)AIM: Create a simple application to demonstrate the concepts boxing
and unboxing.

Code Source:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AWPPRACTICAL2A
{
class Program
{
static void Main(string[] args)
{
int x = 10;
object y = x; //Boxing
Console.WriteLine("Boxing output" + y);
int z = (int)y; //Unboxing
Console.WriteLine("Unboxing" + z);
Console.ReadLine();

}
}
}

Name: Anuj Yadav [9] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Output:

Name: Anuj Yadav [10] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

2b.).AIM: Create a simple application to perform addition and


subtraction using delegate.

Code Source:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1d
{
delegate int Arith(int x, int y);
class Prg
{
public static int Add(int a, int b)
{
return (a + b);
}
public static int Sub(int a, int b)
{
return (a - b);
}
}
class Program
{
static void Main(string[] args)
{
Arith op1 = new Arith(Prg.Add);
Arith op2 = new Arith(Prg.Sub);
int r1 = op1(10, 20);
int r2 = op2(20, 5);
Console.WriteLine("Addition=" + r1);

Name: Anuj Yadav [11] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Console.WriteLine("subtraction=" + r2);
Console.ReadKey();
}
}
}

Name: Anuj Yadav [12] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Output:

Name: Anuj Yadav [13] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

2c.)AIM: Create a simple application to demonstrate use of the


concepts of interfaces.

Code Source:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;

namespace interface1
{
interface Addition
{
int Add();
}
interface Multiplication
{
int Mul();
}
class A : Addition, Multiplication
{
public int x, y;
public A(int a, int b)
{
x = a;
y = b;
Console.WriteLine("1ST NO:" + x);
Console.WriteLine("2ND NO:" + y);

Name: Anuj Yadav [14] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

}
public int Add()
{
return (x + y);
}
public int Mul()
{
return (x * y);
}
}
class MultipleInterface
{
static void Main(string[] args)
{
A a1 = new A(10, 20);
Addition obj = (Addition)a1;
Multiplication obj1 = (Multiplication)a1;
Console.WriteLine("Addition=" + obj.Add());
Console.WriteLine("Multiplication=" + obj1.Mul());
Console.ReadKey();
}
}
}

Name: Anuj Yadav [15] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Output:

Name: Anuj Yadav [16] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

PRACTICAL NO. 3
3a).AIM: Create a simple application to demonstrate your vacation
using calendar control .

Name: Anuj Yadav [17] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Name: Anuj Yadav [18] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Calendar.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

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

protected void Button1_Click(object sender, EventArgs e)


{
Calendar1.Caption = "SAMBARE";
Calendar1.FirstDayOfWeek = FirstDayOfWeek.Sunday;
Calendar1.NextPrevFormat = NextPrevFormat.ShortMonth;
Calendar1.TitleFormat = TitleFormat.Month;
Label2.Text = "Todays Date" + Calendar1.TodaysDate.ToShortDateString();
Label3.Text = "Ganpati Vacation Start: 9-7-2024";
TimeSpan d = new DateTime(2024, 9, 7) - DateTime.Now;
Label4.Text = "Days Remaining For Ganpati Vacation:" + d.Days.ToString();
TimeSpan d1 = new DateTime(2018, 12, 31) - DateTime.Now;
Label5.Text = "Days Remaining for New Year:" + d1.Days.ToString();
if (Calendar1.SelectedDate.ToShortDateString() == "9-13-2018")
Label3.Text = "<b>Ganpati Festival Start</b>";
if (Calendar1.SelectedDate.ToShortDateString() == "9-23-2018")
Label3.Text = "<b>Ganpati Festival End</b>";

}
protected void Calendar1_DayRender(object sender,
System.Web.UI.WebControls.DayRenderEventArgs e)
{
if (e.Day.Date.Day == 5 && e.Day.Date.Month == 9)
{
e.Cell.BackColor = System.Drawing.Color.Yellow;
Label lbl = new Label();
lbl.Text = "<br>Teachers Day!";
e.Cell.Controls.Add(lbl);
Image g1 = new Image();
g1.ImageUrl = "td.jpg";
g1.Height = 20;
g1.Width = 20;
e.Cell.Controls.Add(g1);

Name: Anuj Yadav [19] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

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


{
Calendar1.SelectedDate = new DateTime(2024, 9, 7);
Calendar1.SelectedDates.SelectRange(Calendar1.SelectedDate,
Calendar1.SelectedDate.AddDays(10));
Label lbl1 = new Label();
lbl1.Text = "<br>Ganpati!";
e.Cell.Controls.Add(lbl1);
}
}

protected void Calendar1_SelectionChanged(object sender, EventArgs e)


{
Label1.Text = "Your Selected Date:" + Calendar1.SelectedDate.Date.ToString();

protected void btnReset_Click(object sender, EventArgs e)


{
Label1.Text = "";
Label2.Text = "";
Label3.Text = "";
Label4.Text = "";
Label5.Text = "";
Calendar1.SelectedDates.Clear();

}
}
}

Name: Anuj Yadav [20] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Output:

Name: Anuj Yadav [21] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

3b) Demonstrate the use of Treeview operations on the web form.

Treeview,aspx

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


Inherits="Prac4a_final.WebForm2" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Treeview control navigation:<br />
<br />
</div>
<asp:TreeView ID="TreeView1" runat="server">
<Nodes>
<asp:TreeNode Text="Root" Value="Root">
<asp:TreeNode Text="Web Pages" Value="Web Pages">
<asp:TreeNode NavigateUrl="~/WebForm1.aspx" Text="Page 1"
Value="Page 1"></asp:TreeNode>
<asp:TreeNode NavigateUrl="~/WebForm3.aspx" Text="Page 2"
Value="Page 2"></asp:TreeNode>
</asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
</form>
</body>
</html>

Name: Anuj Yadav [22] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

PRACTICAL NO. 4

4a) Create Web Form to demonstrate use of Adrotator Control.


ADfile.xml
<?xml version="1.0" encoding="utf-8"?>
<Advertisements>
<Ad>
<ImageUrl>rose1.jpg</ImageUrl>
<NavigateUrl>http://www.1800flowers.com</NavigateUrl>
<AlternateText>
Order flowers, roses, gifts and more
</AlternateText>
<Impressions>20</Impressions>
<Keyword>flowers</Keyword>
</Ad>
<Ad>
<ImageUrl>rose2.jpg</ImageUrl>
<NavigateUrl>http://www.babybouquets.com.au</NavigateUrl>
<AlternateText>Order roses and flowers</AlternateText>
<Impressions>20</Impressions>
<Keyword>gifts</Keyword>
</Ad>
<Ad>
<ImageUrl>rose3.jpeg</ImageUrl>
<NavigateUrl>http://www.flowers2moscow.com</NavigateUrl>
<AlternateText>Send flowers to Russia</AlternateText>
<Impressions>20</Impressions>
<Keyword>russia</Keyword>
</Ad>
</Advertisements>

4a.Adrotator.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs"
Inherits="Prac4a_final.WebForm3" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<asp:AdRotator ID="AdRotator1" runat="server" DataSourceID="XmlDataSource1"
OnAdCreated="AdRotator1_AdCreated" />
<asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="~/ADfile.xml"></asp:XmlDataSource>

Name: Anuj Yadav [23] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

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

Name: Anuj Yadav [24] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Output:

Name: Anuj Yadav [25] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

4b) Create Web Form to demonstrate use User Controls

Name: Anuj Yadav [26] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Name: Anuj Yadav [27] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Name: Anuj Yadav [28] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Output:

Name: Anuj Yadav [29] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

PRACTICAL NO. 5
5a) Create a simple web form with various server controls to demonstrate
settings and use of the properties.
5b) Create a registration form to demonstrate the use of validation controls

Select the highlighted option

(.net frame work and then Asp.net web application)

And then click next

Name: Anuj Yadav [30] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Give name to the project

Select appropriate folder

And then click next.

Select Empty and click Create

Name: Anuj Yadav [31] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Creating Project option is processed

In the Solution Explorer select Project Name and right click

Select Add  Web Form

A dialog box appears


Give the name to the web form and click ok

In the new web form


Go To Table Menu  Insert Table option

Name: Anuj Yadav [32] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Insert table dialog box appears


Select rows, columns and background
Click ok

Merge the first cell

Name: Anuj Yadav [33] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Type Login Form, Username and Password , Confirm Password in the respective columns
Add 3 text boxes in the columns and ‘Reset’ and ‘Submit’ button in columns

Change the ID and Text of both the buttons

Name: Anuj Yadav [34] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Do similarly for button 2


Go To ToolboxValidation Controls Compare field Validator
Drag and drop in the 4th row of the 3rd column
(Next to password field)
Right click and Select Properties

Name: Anuj Yadav [35] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

In Control to Compare , add Textbox 2

In Control to Validate , add Textbox 3

Change the error message “Password does not match”

Student details form

Click Edit ItemsAdd ( in the dialog box)Enter ‘Bsc It’ in Text and Value  Click OK

Name: Anuj Yadav [36] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Add Gender radio buttons


Then Add Documents submitted in the Check box list option

Add Submit button

Name: Anuj Yadav [37] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Output: (Server Controls )

Navigation Control

Name: Anuj Yadav [38] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Click on the arrow ‘>’  Select ‘Edit Menu Items’

Name: Anuj Yadav [39] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

In the dialog box Click ‘Add root item

Change Text and Value

Name: Anuj Yadav [40] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Click on Navigate URL


Select Login.aspx
Add child node same as Tree View

Validation

Drag and drop Range Validation

Name: Anuj Yadav [41] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Make max value 24, min value 18

Error message ‘Age between 18 to 24

Control to validate  ‘TextBox2’

Name: Anuj Yadav [42] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

PRACTICAL NO. 6
6a)aim:create a web application for inserting and deleting records from
database.

From Start → Select SQL Management Studio→ Choose Windows Authentication


(Note the name of the Server)
Then select the new query option

(highlighted in the above picture)

Then in the new query type the following code

create database practical;


use practical;
create table customer1
(custid varchar(5) primary key,
custname varchar (50),
city varchar(25),
orderid varchar(10),
mobileno varchar(15))

Name: Anuj Yadav [43] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

insert into customer1 values('001','Gaurav shah','Mumbai','00867','904567834')


insert into customer1 values('002','Jiten shah','Mumbai','00867','904567834')
insert into customer1 values('003','Radha Iyer','Bangalore','00867','904567834')
select * from customer1;
Step:
Start Visual Studio
Choose Create New Project

Click Next
Give Name to the Project
(A blank Project will be created)
Add a new Web Form in the Project)

Go→ Tool box and add Grid view

Add a GridView

Name: Anuj Yadav [44] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Click on the side arrow and choose New data source option.

Then follow the steps in the wizard

Name: Anuj Yadav [45] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Click on New Connection

Select the Database


Then click Test Connection and then select OK

Name: Anuj Yadav [46] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Name: Anuj Yadav [47] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Note down the connection string

Name: Anuj Yadav [48] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

If you want to save the connection string with different name you can save

Name: Anuj Yadav [49] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Name: Anuj Yadav [50] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

PRACTICAL NO. 7

7a)create a web application demonstrate the use of different types of cookies.

Choose the column to be displayed

Name: Anuj Yadav [51] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Name: Anuj Yadav [52] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
namespace Pract_6a
{
public partial class Default1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack == false)
{string connStr = "Data Source = HP-LAPTOP; Initial Catalog = practical; Integrated
Security = True";
SqlConnection con = new SqlConnection(connStr);
SqlCommand cmd = new SqlCommand("Select Distinct city from customer1", con);
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
DropDownList1.DataSource = reader;

Name: Anuj Yadav [53] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

DropDownList1.DataTextField = "city";
DropDownList1.DataBind();
reader.Close();
con.Close(); } }
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "The You Have Selected : " + DropDownList1.SelectedValue;
}}}

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;

Name: Anuj Yadav [54] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

namespace Pract_6a
{
public partial class Default3 : System.Web.UI.Page
{ protected void Page_Load(object sender, EventArgs e)
{ } protected void Button1_Click(object sender, EventArgs e)
{ string connStr = "Data Source = HP-LAPTOP; Initial Catalog = practical; Integrated
Security = True";
SqlConnection con = new SqlConnection(connStr);
string InsertQuery = "insert into customer1
values(@custid,@custname,@city,@orderid,@mobileno)";
SqlCommand cmd = new SqlCommand(InsertQuery, con);
cmd.Parameters.AddWithValue("@custid", TextBox1.Text);
cmd.Parameters.AddWithValue("@custname", TextBox2.Text);
cmd.Parameters.AddWithValue("@city", TextBox3.Text);
cmd.Parameters.AddWithValue("@orderid", TextBox4.Text);
cmd.Parameters.AddWithValue("@mobileno", TextBox4.Text);
con.Open();
cmd.ExecuteNonQuery();
Label1.Text = "Record Inserted Successfuly.";
con.Close();
}protected void Button2_Click(object sender, EventArgs e)
{
string connStr = "Data Source = HP-LAPTOP; Initial Catalog = practical; Integrated
Security = True";
SqlConnection con = new SqlConnection(connStr);
string InsertQuery = "delete from customer1 where custid=@custid";
SqlCommand cmd = new SqlCommand(InsertQuery, con);
cmd.Parameters.AddWithValue("@custid", TextBox1.Text);
con.Open();
cmd.ExecuteNonQuery();

Name: Anuj Yadav [55] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Label1.Text = "Record Deleted Successfuly.";


con.Close();
}
}

}Forms View Go to Toolox→ Choose Forms View

In Choose Data Source option


Select the previously created Data Source

Select SqlDataSource After Selecting the previous DataSource the details in the Form View will be
changed

Name: Anuj Yadav [56] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Click the enable paging option checkbox(You can select different Format y choosing Auto Format
option)

Name: Anuj Yadav [57] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Output:

Details View From the tool box select details view and Drag and drop in the view form.

Select the existing data source created.(If not created the datasource then create as per the
previous steps of Configuring the Sql data Source)

Name: Anuj Yadav [58] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Click the Edit Fields


option in the list

Name: Anuj Yadav [59] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

You can rearrange the Columns in the view.


Select the Add New Field option in the Details View

Select the Data Field you want to bound to , give proper Header name to the column and
click on OK
The same will be reflected in the details view

Click the enable paging option in the window

Name: Anuj Yadav [60] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Then run the project

Output

Name: Anuj Yadav [61] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

PRACTICAL NO. 8
8a)Create a web application to denote Bootsrap installation and JS
Bootsrap button
Bootstrap installation in Visual studio

Select the project name in Solution Explorer and

Right click the project


select Manage Nuget Packages

Name: Anuj Yadav [62] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Select the Browse Tab

Click on OK in the Dialog box


(Once installed successfully installed it will show the following changes in the window.)

Name: Anuj Yadav [63] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Close the TAB


Add a blank web form
Go To→ Source Tab of the Web Form
In the <html> tag add Lang=”en”
and add the links as per the screen shot within the head tag

Code in Source file

<html lang="en">
<head runat="server">

Name: Anuj Yadav [64] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

<meta charset="UTF-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge">


<meta name="viewport" content="width=device-width, initial-scales1.0" />

<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css "


rel="stylesheet"
integrity="sha384-
+0n@xVW2e5R500mGNYDnhzAbDs0XxcvSN1TPprVMTNDbiVZCxYb0017+Avy T62x"
crossorigin="anonymous">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<h2>Buttons</h2>
<button class ="btn btn-primary">Primary Button</button>
<button class ="btn btn-secondary">Secondary Button</button><h2>Link as
Button</h2>
<a href="#" class="btn btn-info">information button</a>
<a href="#" class="btn btn-success">successor button</a>
<h2>Button Sizes</h2>
<button class ="btn btn-lg btn-danger">Large Danger Button</button>

<button class ="btn btn-sm btn-warning">small warning Button</button>


<h2>Button Styles</h2>
<button class ="btn btn-outline-primary">1st Button</button>
<button class ="btn btn-outline-secondary">2nd Button</button>
<h2>Button Group</h2>
<div class="btn-group">
<a href="#" class="btn btn-info btn-lg">button1</a>
<a href="#" class="btn btn-success btn-sm">button2</a>

Name: Anuj Yadav [65] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

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

Debug the Code The following screen is seen

Name: Anuj Yadav [66] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

OUTPUT:

Name: Anuj Yadav [67] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

8b) Create a web application to demonstrate use of various Ajax controls.


Create a new web application and in that right click the solution
Add —> New Item→ Web Form(Ajax.aspx)
In the Toolbox → Drag the Script Manager

After dragging the Script Manager In the toolbox→ Drag the timer

Name: Anuj Yadav [68] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Go to Timer→ Properties(By right clicking the timer)

Add one label in the web form

Make the Interval property as 5000

Name: Anuj Yadav [69] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Double click the Timer and the .aspx.cs page opens


Write the following code on the .cs page (Only the highlighted)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Validation_Ajax
{
public partial class Ajax : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
} protected void Timer1_Tick(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToString();
}
}
}

Name: Anuj Yadav [70] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

8c) Create a web application to denote Nuget installation and use of


Nuget

Name: Anuj Yadav [71] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Click on install

Name: Anuj Yadav [72] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Installation successfully completed

Now click on the installed tab

Name: Anuj Yadav [73] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

Default.aspx

Default.aspx.cs
using Newtonsoft.Json;

using System.Reflection.Emit;

using System.Security.Principal;

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

namespace Nuget

public partial class Default : System.Web.UI.Page

protected void Page_Load(object sender, EventArgs e)

protected void Button1_Click(object sender, EventArgs e)

Account account = new Account

Name = "saurav singh",

Email = "[email protected]",

DOB = new DateTime(1982, 12, 13, 0, 0, 0, DateTimeKind.Local),

};

Name: Anuj Yadav [74] Roll No: 128


TYBSC.IT ADVANCED WEB PROGRAMMING

string json =

JsonConvert.SerializeObject(account, Newtonsoft.Json.Formatting.Indented);

Label1.Text = json;

public class Account // Ensure this class is defined

public string Name { get; set; }

public string Email { get; set; }

public DateTime DOB { get; set; }

Output

Name: Anuj Yadav [75] Roll No: 128

You might also like