You are on page 1of 39

WEB DESIGNING

AND WEB
TECHNOLOGIES-II
Web Designing and Web Technologies-II

Sr. Title Date Signature


No

1 HTML and PHP

2 AJAX

3 ASP.NET

4 VB.NET

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

Index.html

<html>

<head>

<title>User Details</title>

</head>

<body>

<form method="get" action="txtbox.php">

<br> <br>

<center>

<table border=1>

<tr>

<td> Name :</td>

<td> <input type="text" name="txtname"></td></tr>

<tr>

<td> Age : </td>

<td> <input type="text"


name="txtage"></td></tr>

<tr>

<td> Qualification :</td>

<td> <input type="text" name="txtqual"></td></tr>

<tr>

<td colspan=2 style="text-align:center">

<input type="submit"
value="Submit"></td></tr>

</table>

</center>

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

</form>

</body>

</html>

Txtbox.php

<html>

<center>

<h2> User Details</h2>

<br>

Name:<?php echo $_GET["txtname"]; ?><br>

Age: <?php echo $_GET["txtage"]; ?> <br>

Qualification : <?php echo $_GET["txtqual"]; ?>

</center>

</html>

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

Output:

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

Index.html

<html>

<head> <title> User Details </title> </head>

<body>

<form method="get" action="chkbox.php">

<br> <br> <center>

Select your subjects:<br>

<input type="checkbox" name="C" value="C"> C

<input type="checkbox" name="C++" value="C++"> C++

<input type="checkbox" name="java" value="JAVA"> Java

<br> <input type="submit" value="Select">

</center> </form>

</body>

</html>

Chkbox.php

<html>

The subjects you selected are :

<br>

<?php if(isset($_GET["C"]))

echo $_GET["C"]; echo' ';?>

<?php if(isset($_GET["C++"]))

echo $_GET["C++"]; echo' ';?>

<?php if(isset($_GET["java"]))

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

echo $_GET["java"];

?>

</html>

Output:

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

Index.html

<html>

<head> <title>User Details</title> </head>

<body>

<form method="get" action="radio.php">

<br>

<br>

<center>

Select your gender:<br>

<input type="radio" name="gender" value="Male"> Male

<input type="radio" name="gender"


value="Female">Female

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

<br> <input type="submit" value="Submit">

</center> </form>

</body>

</html>

Radio.php

<html>

Gender: <?php echo $_GET["gender"]; ?>

</html>

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

Output:

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

Ajax.html

<!DOCTYPE html>

<html>

<body>

<div id="demo">
<h2>The text will appear here</h2></div>

<button type="button" onclick="loadDoc()">Change Content</button>


<script>
function loadDoc()
{
var xhttp = new XMLHttpRequest();

xhttp.onreadystatechange = function()
{
if (xhttp.readyState == 4 && xhttp.status == 200)
{
document.getElementById("demo").innerHTML = xhttp.responseText;

}
};
xhttp.open("GET", "info.txt", true);
xhttp.send();

}
</script>

</body>

</html>

Info.html:

TYCS 2015-2016 !

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

Output:

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

Studentreg.aspx:

<%​@ Page Language="vb" AutoEventWireup="false" CodeBehind="studentreg.aspx.vb"


Inherits="registration.studentreg" ​%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Registration form</title>
<style type="text/css">
.auto-style1 {
width: 26%; height: 390px; }
.auto-style3 {
width: 135px; height: 55px;}
.auto-style4 { height: 55px; }
.auto-style5 { width: 135px; height: 51px;}
.auto-style6 { height: 51px; }
.auto-style7 {width: 135px;height: 63px;}
.auto-style8 { height: 63px; }
.auto-style9 { width: 135px; height: 64px;}
.auto-style10 { height: 64px; }
.auto-style11 { width: 135px;height: 48px;}
.auto-style12 {height: 48px; }
.auto-style13 {
width: 135px; height: 60px; }
.auto-style14 { height: 60px; }
.auto-style15 { height: 41px; }
.auto-style16 { height: 41px; }
.auto-style17 {text-decoration: underline;}
</style>
</head>
<body>
<form id="form1" runat="server">
<div style="center">

<p style="margin-left: 360px; font-size: x-large; height: 33px;">


<span class="auto-style17"><strong>Student Registration
Form</strong></span><br />
</p>
<p style="margin-left: 360px; font-size: x-large; height: 33px;">
<asp:Label ID="Label7" runat="server" Font-Size="Larger"
ForeColor="#00CC00"></asp:Label>
<br />
</p>
<table class="auto-style1">
<tr>
<td class="auto-style3">
<asp:Label ID="Label1" runat="server" Font-Size="Larger" Text="Name
:"></asp:Label>
</td>
<td class="auto-style4">
<asp:TextBox ID="TextBox1" runat="server" Height="23px"
Width="127px"></asp:TextBox>
</td> </tr>

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

<tr>
<td class="auto-style5">
<asp:Label ID="Label2" runat="server" Font-Size="Larger" Text="ID
:"></asp:Label>
</td>
<td class="auto-style6">
<asp:TextBox ID="TextBox2" runat="server" Height="23px"
Width="127px"></asp:TextBox>
</td> </tr>
<tr>
<td class="auto-style7">
<asp:Label ID="Label3" runat="server" Font-Size="Larger" Text="Age
:"></asp:Label>
</td>
<td class="auto-style8">
<asp:TextBox ID="TextBox3" runat="server" Height="23px"
Width="127px"></asp:TextBox>
</td> </tr>
<tr>
<td class="auto-style9">
<asp:Label ID="Label4" runat="server" Font-Size="Larger" Text="Class
:"></asp:Label>
</td>
<td class="auto-style10">
<asp:TextBox ID="TextBox4" runat="server" Height="23px"
Width="127px"></asp:TextBox>
</td> </tr>
<tr>
<td class="auto-style11">
<asp:Label ID="Label5" runat="server" Font-Size="Larger" Text="Email
Id:"></asp:Label>
</td>
<td class="auto-style12">
<asp:TextBox ID="TextBox5" runat="server" Height="23px"
Width="127px"></asp:TextBox>
</td> </tr>
<tr> <td class="auto-style13">
<asp:Label ID="Label6" runat="server" Font-Size="Larger" Text="Contact No
:"></asp:Label>
</td>
<td class="auto-style14">
<asp:TextBox ID="TextBox6" runat="server" Height="23px"
Width="127px"></asp:TextBox>
</td> </tr>
<tr>
<td class="auto-style15" colspan="2">
<asp:Button ID="Button1" runat="server" Font-Size="Large" Height="33px"
style="margin-left: 110px" Text="Submit" Width="70px" />
</td> </tr>
</table>
</div> </form>
</body>
</html>

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

Studentreg.aspx.vb:

Public Class studentreg


Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Me.Load
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click

Label7.Text = "Form Successfully submitted !!"


End Sub
End Class

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

Output:

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

Viewstate.aspx:

<%​@ Page Language="vb" AutoEventWireup="false" CodeBehind="Viewstate.aspx.vb"


Inherits="registration.Viewstate" ​%>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 30%;
height: 85px;
margin-left: 380px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

<table class="auto-style1">
<tr>
<td>
<asp:Button ID="Button1" runat="server" Font-Size="Large"
Text="Clicks " />
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label1" runat="server" Font-Size="Large"
Text="No of clicks :"></asp:Label>
<asp:Label ID="Label2" runat="server"></asp:Label>
</td>
</tr>
</table>

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

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

Viewstate.aspx.vb:

Public Class Viewstate


Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
End Sub

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles


Button1.Click
Dim count As Integer
If ViewState("count") Is Nothing Then
count = 1
Else
count = CType(ViewState("count"), Integer) + 1
End If
ViewState("count") = count
Label2.Text = ViewState("count")
End Sub
End Class

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

Output :

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

Cookies.aspx:

<%​@ Page Language="vb" AutoEventWireup="false" CodeBehind="Cookies.aspx.vb"


Inherits="registration.Cookies" ​%>

<!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 id="Head1" runat="server">
<title>Cookies</title>
</head><body>
<form id="form1" runat="server">
<div>
<asp:Label ID="lblwelcome" runat="server"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" />
<br />
<asp:Label ID="Label1" runat="server"></asp:Label>
&nbsp;<asp:Label ID="Label2" runat="server"></asp:Label>
</div>
</form>
</body>
</html>

Cookies.aspx.vb:

Public Class Cookies


Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)


Handles Me.Load
Dim Cookie As HttpCookie = Request.Cookies("preference")
If Cookie Is Nothing Then
lblwelcome.Text = "<b>Unknown Customer</b>"
Else

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

Label1.Text = "cookie found"


Label2.Text = "welcome " & Cookie("Name")
End If
End Sub

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles


Button1.Click
Dim Cookie As HttpCookie = Request.Cookies("preference")
If Cookie Is Nothing Then
Cookie = New HttpCookie("preference")
End If
Cookie("name") = TextBox1.Text
Cookie.Expires = DateTime.Now.AddYears(1)
Response.Cookies.Add(Cookie)
Label1.Text = ""
lblwelcome.Text = ""
Label2.Text = "<b>Cookie created</b>"
Label1.Text &= "new Customer " & Cookie("Name")

End Sub
End Class

Output :

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

Default.aspx:

<%@ Page Title="Home Page" Language="vb" MasterPageFile="~/Site.Master"


AutoEventWireup="false"

CodeBehind="Default.aspx.vb" Inherits="Register._Default" %>

<asp:Content ID="HeaderContent" runat="server"


ContentPlaceHolderID="HeadContent">

<style type="text/css">

.style1

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

width: 100%;

height: 158px;

.style2

{}

.style5

height: 21px;

width: 144px;

.style6

width: 144px;

.style7

height: 21px;

width: 159px;

.style8

width: 159px;

.style9

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

height: 21px;

width: 140px;

.style10

width: 140px;

.style11

height: 20px;

width: 140px;

.style12

height: 20px;

width: 144px;

.style13

height: 20px;

width: 159px;

</style>

</asp:Content>

<asp:Content ID="BodyContent" runat="server"


ContentPlaceHolderID="MainContent">

<table class="style1">

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

<tr>

<td class="style9">

Name</td>

<td class="style5">

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

</td>

<td class="style7">

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

ControlToValidate="TextBox1" ErrorMessage="Please Enter your


Name"

ForeColor="Red">*</asp:RequiredFieldValidator>

</td>

<td class="style2" rowspan="7">

<asp:ValidationSummary ID="ValidationSummary1" runat="server"


Height="169px"

BorderStyle="None" />

</td>

</tr>

<tr>

<td class="style10">

ID</td>

<td class="style6">

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

</td>

<td class="style8">

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

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

ControlToValidate="TextBox2" ErrorMessage="Please Enter ID"

ForeColor="Red">*</asp:RequiredFieldValidator>

</td>

</tr>

<tr>

<td class="style11">

Age</td>

<td class="style12">

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


TextMode="Number"></asp:TextBox>

</td>

<td class="style13">

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

ControlToValidate="TextBox3" ErrorMessage="Age must be between


18-22"

ForeColor="Red" MaximumValue="22" MinimumValue="18"


Type="Double">*</asp:RangeValidator>

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

ControlToValidate="TextBox3" ErrorMessage="Please Enter Age"

ForeColor="Red">*</asp:RequiredFieldValidator>

</td>

</tr>

<tr>

<td class="style9">

Email Id</td>

<td class="style5">

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

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

</td>

<td class="style7">

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

ControlToValidate="TextBox4" ErrorMessage="Please Enter Proper


Email ID"

ForeColor="Red"

ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">*</asp:Regu
larExpressionValidator>

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

ControlToValidate="TextBox4" ErrorMessage="Please Enter Email"

ForeColor="Red">*</asp:RequiredFieldValidator>

</td>

</tr>

<tr>

<td class="style10">

Password</td>

<td class="style6">

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


TextMode="Password"></asp:TextBox>

</td>

<td class="style8">

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

ControlToValidate="TextBox5" ErrorMessage="Please Enter a


Password"

ForeColor="Red">*</asp:RequiredFieldValidator>

</td>

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

</tr>

<tr>

<td class="style9">

Confirm Password</td>

<td class="style5">

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


TextMode="Password"></asp:TextBox>

</td>

<td class="style7">

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

ControlToCompare="TextBox5" ControlToValidate="TextBox6"

ErrorMessage="Password doesn't match"


ForeColor="Red">*</asp:CompareValidator>

</td>

</tr>

<tr>

<td class="style10">

<asp:Label ID="Label1" runat="server"></asp:Label>

</td>

<td class="style6">

<asp:Button ID="Button1" runat="server" Text="Submit" />

</td>

<td class="style8">

&nbsp;</td>

</tr>

</table>

</asp:Content>

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

Output :

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

Adrotator.aspx:

<%​@ Page Language="vb" AutoEventWireup="false" CodeBehind="Adrotator.aspx.vb"


Inherits="registration.Adrotator" ​%>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Adrotator</title>
</head>
<body>
<form id="form1" runat="server">
<div style="text-align: center">
<br /> <br /> <br /> <br />
<asp:AdRotator ID="AdRotator1" runat="server"
DataSourceID="XmlDataSource1" Height="250px" Width="350px" />
<asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="~/XMLFile1.xml"></asp:XmlDataSource>

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

XMLFile1.xml:

<?xml version="1.0" encoding="utf-8" ?>


<Advertisements>
<Ad>
<ImageUrl>http://localhost:63798/images/flower1.jpeg</ImageUrl>
<AlternateText>./images/Image not found</AlternateText>
</Ad>
<Ad>
<ImageUrl>http://localhost:63798/images/flower2.jpeg</ImageUrl>
<AlternateText>Image not found</AlternateText>
</Ad>
<Ad>
<ImageUrl>http://localhost:63798/images/flower3.jpeg</ImageUrl>
<AlternateText>Image not found</AlternateText>
</Ad>
</Advertisements>

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

Output :

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

Postback.aspx

<%​@ Page Language="vb" AutoEventWireup="false" CodeBehind="postback.aspx.vb"


Inherits="registration.postback" ​%>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>AutoPostback</title>
</head>
<body>
<form id="form1" runat="server">
<div>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:ListBox ID="ListBox1" runat="server" AutoPostBack="True">
<asp:ListItem>Summer</asp:ListItem>
<asp:ListItem>Winter</asp:ListItem>
<asp:ListItem>Rainy</asp:ListItem>
<asp:ListItem>Spring</asp:ListItem>
<asp:ListItem>Autumn</asp:ListItem>
</asp:ListBox>
&nbsp;
<br />
<br />
&nbsp;
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
style="margin-left: 18px; margin-top: 0px">
<asp:ListItem>Red</asp:ListItem>
<asp:ListItem>Green</asp:ListItem>
<asp:ListItem>Blue</asp:ListItem>
<asp:ListItem>White</asp:ListItem>
<asp:ListItem>Black</asp:ListItem>
<asp:ListItem>Lime</asp:ListItem>
</asp:DropDownList>
&nbsp;&nbsp;
<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="TextBox1" runat="server"
AutoPostBack="True"></asp:TextBox>
&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" Font-Names="Calibri"
Font-Size="Large"></asp:Label>

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

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

Postback.aspx.vb :

Public Class postback


Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Me.Load

End Sub

Protected Sub ListBox1_SelectedIndexChanged(sender As Object, e As


EventArgs) Handles ListBox1.SelectedIndexChanged
Label1.Text = ListBox1.SelectedItem.ToString()
End Sub

Protected Sub DropDownList1_SelectedIndexChanged(sender As Object, e As


EventArgs) Handles DropDownList1.SelectedIndexChanged
Label1.Text = DropDownList1.SelectedItem.ToString()
End Sub

Protected Sub TextBox1_TextChanged(sender As Object, e As EventArgs)


Handles TextBox1.TextChanged
Label1.Text = TextBox1.Text
End Sub
End Class

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

Output:

S.K.Somaiya College of ASC [Computer Science]


Web Designing and Web Technologies-II

S.K.Somaiya College of ASC [Computer Science]

You might also like