Вы находитесь на странице: 1из 79

VIDYABHARTI TRUST COLLEGE OF BBA & BCA.

UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

1.LABEL,BUTTON AND TEXTBOX CONTROL DEMO (HELLO


WORLD).

 <%@ Page Language="vb" AutoEventWireup="false"


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

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table border="2" align="center" bgcolor="#FFFF99"
cellpadding="10"
cellspacing="10" frame="border" style="font-size: medium; color:
#000000; text-transform: capitalize; font-style: normal; font-weight: bold;
font-family: Arial">
<tr>
<th>Message :
<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox><br/></th>
</tr>
<tr>
<th><asp:Button ID="Button1" runat="server"
Text="SAVE"/></th>
</tr>
<tr>
<th><asp:Label ID="Label1" runat="server"
Text=""></asp:Label></th>
</tr>
</table>
</div>
</form>
</body>
</html>

OUTPUT:-

[Type text] Page 1


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

2.DEMO OF CURRENCY CONVERTER.

 Page: CurrencyConverterDemo.aspx

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="CurrencyConverterDemo.aspx.vb"
Inherits="SimpleInterestDemo.CurrencyConverterDemo" %>

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div align="center">
<h2>....CURRENCY CONVERTER DEMO....</h2>
<asp:Label ID="Label1" runat="server" Text="Enter Rupees
:"></asp:Label>
&nbsp;<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br /><br />
<asp:Button ID="Button1" runat="server" Text="Dollar"
/>&nbsp;&nbsp;
<asp:Button ID="Button2" runat="server" Text="Pound" /><br /><br />
<asp:Label ID="Label2" runat="server" Text=""></asp:Label>
</div>
</form>
</body>
</html>

 Page: CurrencyConverterDemo.aspx.vb

Public Partial Class CurrencyConverterDemo


Inherits System.Web.UI.Page

[Type text] Page 2


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

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


EventArgs) Handles Button1.Click
Label2.Text = "Rupees To Dollar Is :" & Val(TextBox1.Text) * 60
End Sub

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


EventArgs) Handles Button2.Click
Label2.Text = "Rupees To Pound Is :" & Val(TextBox1.Text) * 100
End Sub
End Class

 OUTPUT:-

3.Calculatore Demo.

 Page: CalculatorDemo.aspx

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="CalculatorDemo.aspx.vb"
Inherits="SimpleInterestDemo.CalculatorDemo" %>

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div align="center">
<h2>....CALCULATOR DEMO....</h2>
<asp:Label ID="Label1" runat="server" Text="Enter First Value
:"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br /><br />
<asp:Label ID="Label2" runat="server" Text="Enter Second Value
:"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br /><br />

[Type text] Page 3


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

<asp:Label ID="Label3" runat="server" Text=""></asp:Label>


<br /><br />
<asp:Button ID="Button1" runat="server" Text="Addition(+)" />&nbsp;
<asp:Button ID="Button2" runat="server" Text="Substraction(-)"
/>&nbsp;
<asp:Button ID="Button3" runat="server" Text="Multiplication(*)"
/>&nbsp;
<asp:Button ID="Button4" runat="server" Text="Division(/)" />&nbsp;
</div>
</form>
</body>
</html>

 Page: CalculatorDemo.aspx.vb

Public Partial Class CalculatorDemo


Inherits System.Web.UI.Page

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


EventArgs) Handles Button1.Click
Label3.Text = "Addtion Is :" & CInt(TextBox1.Text) +
CInt(TextBox2.Text)
End Sub

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


EventArgs) Handles Button2.Click
Label3.Text = "Substraction Is :" & CInt(TextBox1.Text) -
CInt(TextBox2.Text)
End Sub

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


EventArgs) Handles Button3.Click
Label3.Text = "Multiplication Is :" & CInt(TextBox1.Text) *
CInt(TextBox2.Text)
End Sub

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


EventArgs) Handles Button4.Click
Label3.Text = "Division Is :" & CInt(TextBox1.Text) /
CInt(TextBox2.Text)
End Sub
End Class

[Type text] Page 4


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

 OUTPUT:-

4.Simple Interest.

 Page : 3_SimpleInterest.aspx

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="3_SimpleInterest.aspx.vb"
Inherits="SimpleInterestDemo._Default" %>

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div align="center">
<h2>.....DEMO OF SIMPLE INTEREST.....</h2>
<asp:Label ID="Label1" runat="server" Text="Value1 :"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label2" runat="server" Text="Value2 :"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<br />

[Type text] Page 5


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

<asp:Label ID="Label3" runat="server" Text="Value3 :"></asp:Label>


<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Simple Interest"
Height="27px"
Width="112px" />&nbsp;&nbsp;
<asp:Button ID="Button2" runat="server" Text="Reset" Width="109px"
Height="26px" />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br />
<asp:Label ID="SimpleInterest" runat="server" Text=""></asp:Label>
</div>
</form>
</body>
</html>

 Page: 3_simpleInterest.aspx.vb

Partial Public Class _Default


Inherits System.Web.UI.Page

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


EventArgs) Handles Button1.Click
SimpleInterest.Text = "Simple Interest : "
SimpleInterest.Text &= CType(TextBox1.Text, Integer) *
CType(TextBox2.Text, Integer) * CType(TextBox3.Text, Integer) / 100
End Sub

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


EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
SimpleInterest.Text = ""
End Sub
End Class

 OUTPUT:-

[Type text] Page 6


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

5. Table like 1 x 1 = 1 Demo.

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="WebForm1.aspx.vb" Inherits="demoone.WebForm1" %>

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
ENTER ANY NUMBER :<asp:TextBox ID="txtnum"
runat="server"></asp:TextBox><br />
<asp:Button ID="Button1" runat="server" Text="TABLE"/>
</div>
</form>
</body>
</html>

 AFTER THAT:-

Public Partial Class WebForm1 Inherits System.Web.UI.Page

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


EventArgs) Handles Button1.Click
For i = 1 To 10
Response.Write(txtnum.Text & "*" & i & "=" &

[Type text] Page 7


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

txtnum.Text * i & "<br/>")


Next
End Sub
End Class

 OUTPUT:-

6. Table Control Demo And Literal Demo.

PAGE: TableLiteral.aspx

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="Table.aspx.vb" Inherits="TableControlDemo._Default" %>

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
ROWS:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br
/>
<br />
COLS:<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br
/>

[Type text] Page 8


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

<br />
<asp:CheckBox ID="CheckBox1" runat="server" /> PUT BORDER
AROUND CELL.
<br /><br />
<asp:Button ID="Button1" runat="server" Text="CREATE" />
<br /><br />
<asp:Table ID="Table1" runat="server">
</asp:Table>
</div>
</form>
</body>
</html>

PAGE 2: TableLiteral.aspx.vb

Partial Public Class _Default


Inherits System.Web.UI.Page

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


System.EventArgs) Handles Me.Load
Table1.BorderStyle = BorderStyle.Inset
Table1.BorderWidth = Unit.Pixel(1)
End Sub

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


EventArgs) Handles Button1.Click
Table1.Controls.Clear()
Dim row, col As Integer
For row = 0 To Val(TextBox1.Text)
Dim rnew As New TableRow()
Table1.Controls.Add(rnew)
For col = 0 To Val(TextBox2.Text - 1)
Dim cellnew As New TableCell()
cellnew.Text = "example cell(" & row.ToString() & ","
cellnew.Text &= col.ToString() & ")"
Dim imgnew As New System.Web.UI.WebControls.Image()
imgnew.ImageUrl = "group2.jpg"
imgnew.Height = 100
imgnew.Width = 100
If CheckBox1.Checked = True Then
cellnew.BorderStyle = BorderStyle.Inset
cellnew.BorderWidth = Unit.Pixel(1)
End If
rnew.Controls.Add(cellnew)
cellnew.Controls.Add(imgnew)

[Type text] Page 9


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

Next
Next
End Sub
End Class

OUTPUT:-

7. Image, ImageButton and ImageMap Demo.

Page:- ImageDemo.aspx

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="WebForm2.aspx.vb" Inherits="ImageDemo.WebForm2" %>

<!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>Untitled Page</title>

[Type text] Page 10


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

</head>
<body>
<form id="form1" runat="server">
<div>
Image Is : <asp:Image ID="Image1" runat="server" Height="100px"
ImageAlign="Middle" ImageUrl="~/images/b1.png" Width="100px"
/><br />
Click On ImageButton : <asp:ImageButton ID="ImageButton1"
runat="server" Height="100px"
ImageAlign="Middle" ImageUrl="~/images/click.jpg"
PostBackUrl="~/Default.aspx"
Width="100px" /><br />
ImageMap Control :
<asp:ImageMap ID="ImageMap1" runat="server" Height="100px"
ImageUrl="~/images/group2.jpg">
<asp:CircleHotSpot NavigateUrl="~/Default.aspx" Radius="50"
X="10" Y="10" />
</asp:ImageMap>
</div>
</form>
</body>
</html>

 OUTPUT:-

 AFTER CLICK ON IMAGEBUTTON AND IMAGEMAP THE


FOLLOWING PAGE(Default.aspx) WILL BE OPEN ...

[Type text] Page 11


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

8. AdRotator Demo.

Page:-AdrotatorDemo.aspx

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="Adrotator.aspx.vb" Inherits="AdrotatorDemo._Default"
MasterPageFile="~/Site1.Master" %>

<asp:Content runat="server" ContentPlaceHolderID="head" ID="content2">


</asp:Content>
<asp:Content runat="server" ContentPlaceHolderID="ContentPlaceHolder1"
ID="content1">
THIS IS MY ADROTATOR DEMO....!<br />
&nbsp;<asp:AdRotator ID="AdRotator1" runat="server"
AdvertisementFile="~/XMLFile1.xml" Height="100px" Width="100px"/>
</asp:Content>

 XMLFile1.xml

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

<Advertisements>
<Ad>
<ImageUrl>images\p1.jpg</ImageUrl>
<NavigatUrl>Page1.aspx</NavigatUrl>
<AlternetText>Images1</AlternetText>
<Impressions> 1 </Impressions>
<Keyword>Images1</Keyword>
</Ad>
<Ad>
<ImageUrl>images\p2.jpg</ImageUrl>
<NavigatUrl>page2.aspx</NavigatUrl>
<AlternetText>Images2 </AlternetText>

[Type text] Page 12


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

<Impressions> 2 </Impressions>
<Keyword>Images2</Keyword>
</Ad>
<Ad>
<ImageUrl>images\p3.jpg</ImageUrl>
<NavigatUrl>page3.aspx</NavigatUrl>
<AlternetText>Images3</AlternetText>
<Impressions> 3 </Impressions>
<Keyword>Images3</Keyword>
</Ad>
<Ad>
<ImageUrl>images\p4.jpg</ImageUrl>
<NavigatUrl>page4.aspx</NavigatUrl>
<AlternetText>Images4 </AlternetText>
<Impressions> 4 </Impressions>
<Keyword>Images4</Keyword>
</Ad>
</Advertisements>

 OUTPUT:-

[Type text] Page 13


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

9. FileUpload Demo.

Page: FileUploadDemo.aspx

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="FileUploadDemo.aspx.vb"
Inherits="SimpleInterestDemo.FileUploadDemo" %>

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div align="center">
<h2>....FILE UPLOAD DEMO....</h2>
<asp:FileUpload ID="FileUpload1" runat="server" /><br /><br />
<asp:Button ID="Button1" runat="server" Text="Upload File" /><br
/><br />
<asp:Label ID="Label1" runat="server" Text=""></asp:Label> <br />
<asp:Label ID="Label2" runat="server" Text=""></asp:Label>
</div>
</form>

[Type text] Page 14


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

</body>
</html>

Page: FileUploadDemo.aspx.vb

Public Partial Class FileUploadDemo


Inherits System.Web.UI.Page

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


EventArgs) Handles Button1.Click
Dim strfile As String
If FileUpload1.HasFile Then
Dim strextensionName1 As String =
System.IO.Path.GetExtension(FileUpload1.FileName).ToLower()
If String.Compare(strextensionName1, ".jpg") = 0 Then
strfile = "~\\images\\" & FileUpload1.FileName
Label1.Text = strfile
End If
FileUpload1.SaveAs(Server.MapPath(FileUpload1.FileName)
End If
Label2.Text = FileUpload1.FileName & " " & "is upload successfully..."
End Sub
End Class

 OUTPUT:-


10. Common Demo of Bullet List, ListBox, CheckBox List, DropDown
List, RadioButton List.

Page:- MixControlsDemo.aspx

<%@ Page Language="vb" AutoEventWireup="false"

[Type text] Page 15


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

CodeBehind="MixControlsDemo.aspx.vb"
Inherits="SimpleInterestDemo.MixControlsDemo" %>

<!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>Untitled Page</title>
<style type="text/css">
.style1
{
width: 100%;
}
.style2
{
font-size: large;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="style1" border="2">
<tr>
<th colspan="2">
<span class="style2">LIST DEMO</span></th>
</tr>
<tr>
<td>
Bullet List</td>
<td>
<asp:BulletedList ID="BulletedList2" runat="server">
<asp:ListItem>ListBox</asp:ListItem>
<asp:ListItem>DropDownList</asp:ListItem>
<asp:ListItem>CheckBoxList</asp:ListItem>
<asp:ListItem>RadioButtonList</asp:ListItem>
</asp:BulletedList>
</td>
</tr>
<tr>
<td>
Select Country<br />
<asp:ListBox ID="ListBox1" runat="server"></asp:ListBox>
</td>

[Type text] Page 16


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

<td>
Select Fruits<br />
<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
Select Hobby<br />
<asp:CheckBoxList ID="CheckBoxList1" runat="server">
</asp:CheckBoxList>
</td>
<td>
Select Course<br />
<asp:RadioButtonList ID="RadioButtonList1" runat="server">
</asp:RadioButtonList>
</td>
</tr>
<tr>
<td colspan="2">
<asp:Button ID="Button1" runat="server" Text="Button" />
</td>
</tr>
<tr>
<td colspan="2">
<asp:Label ID="Label1" runat="server"
Text="Label"></asp:Label>
</td>
</tr>
</table>

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

 Page2:-MixControlsDemo.aspx.vb

Public Partial Class MixControlsDemo


Inherits System.Web.UI.Page

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


System.EventArgs) Handles Me.Load
If Not IsPostBack Then
countrylist()

[Type text] Page 17


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

Fruitlist()
Hobbylist()
Courselist()
End If
End Sub

Public Sub countrylist()


ListBox1.Items.Add("India")
ListBox1.Items.Add("USA")
ListBox1.Items.Add("UK")
ListBox1.Items.Add("Canada")
End Sub

Public Sub Fruitlist()


DropDownList1.Items.Add("Apple")
DropDownList1.Items.Add("Mango")
DropDownList1.Items.Add("Sapota")
DropDownList1.Items.Add("Banana")
End Sub

Public Sub Hobbylist()


CheckBoxList1.Items.Add("Dancing")
CheckBoxList1.Items.Add("Reading")
CheckBoxList1.Items.Add("Travelling")
CheckBoxList1.Items.Add("Writting")
End Sub

Public Sub Courselist()


RadioButtonList1.Items.Add("BCA")
RadioButtonList1.Items.Add("MCA")
RadioButtonList1.Items.Add("MSCIT")
RadioButtonList1.Items.Add("BBA")
End Sub

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


EventArgs) Handles Button1.Click
Dim cl As String = ListBox1.Text
Dim hl As String
Dim fl As String = DropDownList1.Text
Label1.Text = "Selected Country Is: " & cl & "<br /> Selected Fruit IS :"
& fl
For Each lstitem As ListItem In CheckBoxList1.Items
If lstitem.Selected = True Then
hl = hl + lstitem.Text
hl = hl + " "

[Type text] Page 18


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

End If
Next
Label1.Text = "<br /> Selected Hobbies Are :" & hl & "<br /> Selected
Course Is: " & RadioButtonList1.Text & "<br /> Selected Fruit Is: " &
DropDownList1.Text
End Sub
End Class

 OUTPUT:-

11. Login Control.

Page:-LoginDemo.aspx

<%@ Page Language="vb" AutoEventWireup="false"


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

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<fieldset>
<legend>
LOGIN INFORMATION
</legend>
USER NAME:

[Type text] Page 19


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

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


/><br />
PASSWORD:
<asp:TextBox ID="TextBox2" runat="server"
TextMode="Password"></asp:TextBox><br />
<br />
<asp:Button ID="Button1" runat="server" Text="Login"
/>&nbsp;&nbsp;
<asp:Button ID="Button2" runat="server" Text="Reset" />
</fieldset>
</div>
</form>
</body>
</html>

 Page2:-LoginDemo.aspx.vb

Partial Public Class _Default

Inherits System.Web.UI.Page

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


EventArgs) Handles Button1.Click
If TextBox1.Text = "Bhumi" And TextBox2.Text = "Parekh" Then
MsgBox("LOGIN SUCCESSFULLY...!")
Else
MsgBox("INVALID USERNAME OR PASSWORD...!")
End If
End Sub

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


EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
End Sub
End Class

12. Navigation Control (Menu,TreeView,SiteMapPath control) using in


your websit with appropriate place.

Page:-Home.aspx

<%@ Page Language="vb" AutoEventWireup="false"

[Type text] Page 20


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

CodeBehind="Home.aspx.vb" Inherits="NavigationControlDemo._Default" %>

<!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>Untitled Page</title>
<style type="text/css">
.style1
{
width: 100%;
}
.style3
{
font-family: "Times New Roman", Times, serif;
font-weight: bold;
}
.style4
{
color: #0099FF;
}
.style5
{
font-family: "Times New Roman", Times, serif;
font-weight: bold;
color: #0099FF;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="style1" border="2">
<tr>
<th class="style3">
<asp:Image ID="Image1" runat="server" Height="120px"
ImageUrl="~/logo.png"
Width="120px" ImageAlign="AbsMiddle" />

<br />
<h2>
<span class="style5" dir="ltr">
VIDYABHARTI TRUST COLLEGE OF BBA AND BCA,
UMRAKH.</span><span class="style4">&nbsp;&nbsp;

[Type text] Page 21


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

</span>
</h2>
</th>
</tr>
<tr>
<th bgcolor="#CCFFFF">
&nbsp;<asp:Menu ID="Menu1" runat="server"
BackColor="#CCFFFF"
DynamicHorizontalOffset="2" Font-Names="Verdana" Font-
Size="0.8em"
ForeColor="#FF9999" Orientation="Horizontal"
StaticSubMenuIndent="10px">
<StaticSelectedStyle BackColor="#FFCC66" />
<StaticMenuItemStyle HorizontalPadding="5px"
VerticalPadding="2px" />
<DynamicHoverStyle BackColor="#990000" ForeColor="White" />
<DynamicMenuStyle BackColor="#FFFBD6" />
<DynamicSelectedStyle BackColor="#FFCC66" />
<DynamicMenuItemStyle HorizontalPadding="5px"
VerticalPadding="2px" />
<StaticHoverStyle BackColor="#990000" ForeColor="White" />
<Items>
<asp:MenuItem Text="HOME |" Value="HOME |"
NavigateUrl="~/Home.aspx"></asp:MenuItem>
<asp:MenuItem Text=" ABOUT US |" Value=" ABOUT US |"
NavigateUrl="~/Aboutus.aspx"></asp:MenuItem>
<asp:MenuItem Text="CONTACT US |" Value="CONTACT US |"
NavigateUrl="~/Contactus.aspx"></asp:MenuItem>
<asp:MenuItem Text=" GALLERY |" Value=" GALLERY |"
NavigateUrl="~/Gallery.aspx"></asp:MenuItem>
<asp:MenuItem Text="FEEDBACK" Value="FEEDBACK"
NavigateUrl="~/Feedback.aspx"></asp:MenuItem>
</Items>
</asp:Menu>
&nbsp;</th>
</tr>
<tr align="center">
<th>
<br />
THERE ARE FOLLOWING DEPARTMENTS ARE AVAILABLE IN
OUR VTCBB.....!<asp:TreeView
ID="TreeView1" runat="server" ShowLines="True"
LineImagesFolder="~/TreeLineImages">
<Nodes>
<asp:TreeNode Text="DEPARTMENTS"

[Type text] Page 22


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

Value="DEPARTMENTS">
<asp:TreeNode Text="BCA" Value="BCA">
<asp:TreeNode Text="FYBCA"
Value="FYBCA"></asp:TreeNode>
<asp:TreeNode Text="SYBCA"
Value="SYBCA"></asp:TreeNode>
<asp:TreeNode Text="TYBCA"
Value="TYBCA"></asp:TreeNode>
</asp:TreeNode>
<asp:TreeNode Text="BBA" Value="BBA">
<asp:TreeNode Text="FYBBA"
Value="FYBBA"></asp:TreeNode>
<asp:TreeNode Text="SYBBA"
Value="SYBBA"></asp:TreeNode>
<asp:TreeNode Text="TYBBA"
Value="TYBBA"></asp:TreeNode>
</asp:TreeNode>
<asp:TreeNode Text="DIPLOMA"
Value="DIPLOMA"></asp:TreeNode>
<asp:TreeNode Text="DEGREE"
Value="DEGREE"></asp:TreeNode>
<asp:TreeNode Text="NURSING"
Value="NURSING"></asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
</th>
</tr>
<tr>
<th>
ALL RIGHTS RESERVED BT VTCBB @ 2018, UMRAKH.</th>
</tr>
</table>
</div>
</form>
</body>
</html>

 OUTPUT:-

[Type text] Page 23


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

13. LinkButton and HyperLink Demo.

Page:-Default.aspx

<%@ Page Language="vb" AutoEventWireup="false"


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

<!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>Untitled Page</title>
<style type="text/css">
.style1
{
width: 40%;
height: 206px;
}
.style2
{
width: 261px;
}
.style3
{
width: 495px;
}
.style4

[Type text] Page 24


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

{
color: #3366FF;
font-weight: bold;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<table class="style1" align="center" border="2">
<tr>
<th colspan="2">
<h2 class="style4">
.....LOGIN PAGE....</h2>
</th>
</tr>
<tr>
<th class="style2">
NAME:-</th>
<th class="style3">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</th>
</tr>
<tr>
<th class="style2">
PASSWORD:-</th>
<th class="style3">
<asp:TextBox ID="TextBox2" runat="server"
TextMode="Password"></asp:TextBox>
</th>
</tr>
<tr>
<th colspan="2">
<asp:Button ID="Button1" runat="server" Text="LOGIN"
Width="99px" />
</th>
</tr>
<tr>
<th colspan="2">
<asp:LinkButton ID="LinkButton1" runat="server" Text="FORGET
PASSWORD..??"
PostBackUrl="~/fpass.aspx"></asp:LinkButton>
</th>
</tr>
<tr>
<th colspan="2">

[Type text] Page 25


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

<asp:HyperLink ID="HyperLink1" runat="server"


NavigateUrl="~/RegPage.aspx">DO YOU WANT TO ADD
ACCOUNT...?</asp:HyperLink>
</th>
</tr>
</table>
</form>
</body>
</html>

 Default.aspx.vb

Partial Public Class _Default


Inherits System.Web.UI.Page

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


EventArgs) Handles Button1.Click
If TextBox1.Text = "bhumi" And TextBox2.Text = "123" Then
Response.Redirect("home.aspx")
Else
MsgBox("USERNAME OR PASSWORD IS INCORRECT...!")
End If
End Sub
End Class

 OUTPUT:-

When We Click On Link Button (“FORGET PASSWORD”) The Follwing


Page Will Open:-

[Type text] Page 26


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

When We Click On HyperLink The Page (“Do You Want To Add Account
? ”) Will Open:-

14. Calender Control Demo.

Page:-CalendarDemo.aspx

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="Calendardemo.aspx.vb" Inherits="ViewStateDemo._Default"
%>

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div align="center">
<h1>....CALENDAR DEMO....</h1>
<asp:Calendar ID="Calendar1" runat="server"></asp:Calendar><br

[Type text] Page 27


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

/><br />
<asp:Button ID="Button1" runat="server" Text="VIEW DATE" /><br
/><br />
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
</div>
</form>
</body>
</html>

Page:-CalendarDemo.aspx.vb

Partial Public Class _Default


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(ByVal sender As Object, ByVal e As


EventArgs) Handles Button1.Click
Label1.Text = "SELECTED DATE IS :" & Calendar1.SelectedDate
End Sub
End Class

 OUTPUT:-


15. RequiredFieldValidator, RangeValidator, RegularExpressValidator,
CompareValidator, CustomeValidator and Validation summary.

[Type text] Page 28


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

Page1:-ValidationDemo.aspx

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="ValidationDemo.aspx.vb" Inherits="ValidationDemo._Default"
%>

<!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>Untitled Page</title>
<style type="text/css">
.style1
{
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="style1" align="center" border="2" bgcolor="#CCFFFF"
dir="ltr"
frame="border" width="60%">
<tr>
<th colspan="3" style="color: #800080">
....REGISTRATION FORM....</th>
</tr>
<tr>
<td>
Name</td>
<td>
<asp:TextBox ID="txtname" runat="server"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server"
ErrorMessage="Please Enter Name...!"
ControlToValidate="txtname"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
Address</td>

[Type text] Page 29


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

<td>
<asp:TextBox ID="txtadd" runat="server"
TextMode="MultiLine"></asp:TextBox>
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td>
Gender</td>
<td>
<asp:RadioButtonList ID="rdogen" runat="server">
<asp:ListItem>Male</asp:ListItem>
<asp:ListItem>Female</asp:ListItem>
</asp:RadioButtonList>
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td>
Email</td>
<td>
<asp:TextBox ID="txtmail" runat="server"></asp:TextBox>
</td>
<td>
<asp:RegularExpressionValidator
ID="RegularExpressionValidator1" runat="server"
ErrorMessage="Please Enter Correct Email-Id..!"
ControlToValidate="txtmail"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td>
Password</td>
<td>
<asp:TextBox ID="txtpass" runat="server"
TextMode="Password"></asp:TextBox>
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td>
Confirm Password</td>

[Type text] Page 30


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

<td>
<asp:TextBox ID="txtcpass" runat="server"
TextMode="Password"></asp:TextBox>
</td>
<td>
<asp:CompareValidator ID="CompareValidator1" runat="server"
ErrorMessage="Password and Confirm Password Must Be
Match...!" ControlToCompare="txtpass"
ControlToValidate="txtcpass"></asp:CompareValidator>
</td>
</tr>
<tr>
<td>
Age</td>
<td>
<asp:TextBox ID="txtage" runat="server"></asp:TextBox>
</td>
<td>
<asp:RangeValidator ID="RangeValidator1" runat="server"
ControlToValidate="txtage"
ErrorMessage="Age Must Be Between 18 to 50..!"
MaximumValue="50" MinimumValue="18"></asp:RangeValidator>
</td>
</tr>
<tr>
<td>
Mobile No</td>
<td>
<asp:TextBox ID="txtmono" runat="server"></asp:TextBox>
</td>
<td>
<asp:CustomValidator ID="CustomValidator1" runat="server"
ClientValidationFunction="lengthcheck" ControlToValidate="txtmono"
ErrorMessage="Mobile Number Length Maximum 10
Digit...!"></asp:CustomValidator>
</td>
</tr>
<tr>
<td colspan="3">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button1" runat="server" Text="Submit" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb

[Type text] Page 31


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button2" runat="server" Text="Reset" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;
<asp:Button ID="Button3" runat="server" Text="Cancel" />
</td>
</tr>
<tr>
<td colspan="3">
Validation:&nbsp;
<asp:ValidationSummary ID="ValidationSummary1"
runat="server" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

Page2:-ValidationDemo.aspx.vb

Partial Public Class _Default


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(ByVal sender As Object, ByVal e As


EventArgs) Handles Button1.Click
If Page.IsValid Then
Response.Redirect("welcome.aspx")
End If
End Sub
Sub lengthcheck(ByVal sender As Object, ByVal args As

[Type text] Page 32


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

ServerValidateEventArgs) Handles CustomValidator1.ServerValidate


Dim len As Integer = args.Value.Length
If len = 10 Then
args.IsValid = True
Else
args.IsValid = False
End If

End Sub
End Class

OUTPUT:-

16. Make usercontrol(.ascx file) and use on usercontroldemo(.aspx) file.

Page:- UserControl.aspx

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="UserControl.aspx.vb"
Inherits="USERCONTROLDEMO._Default" %>

<%@ Register TagPrefix="Bhumi" TagName="Greet" Src="~/Greeting.ascx"%>


<%@ Register TagPrefix="Bhumi" TagName="Login" Src="~/Login.ascx"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

[Type text] Page 33


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

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


<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<Bhumi:Greet ID="greet1" runat="server" />
<Bhumi:Login ID="login1" runat="server" />
</div>
</form>
</body>
</html>

Page2:- Login.ascx

<%@ Control Language="vb" AutoEventWireup="false"


CodeBehind="Login.ascx.vb" Inherits="USERCONTROLDEMO.Login" %>

<fieldset>
<legend>Greeting Information </legend>
<br />
Enter Username :
<asp:TextBox ID="txtuname" runat="server"></asp:TextBox>
<br />
<br />
Enter Password :
<asp:TextBox ID="txtpass" runat="server"
TextMode="Password"></asp:TextBox>
<br />
<br />
<asp:Button ID="btnlogin" runat="server" Text="Login" />
&nbsp;<asp:Button ID="btncancel" runat="server" Text="Cancel" />
<br />
<br />
<asp:Label ID="lbllogin" runat="server"></asp:Label>
</fieldset>

 Page 2.1:-Login.ascx.vb

Public Partial Class Login


Inherits System.Web.UI.UserControl

[Type text] Page 34


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

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


System.EventArgs) Handles Me.Load

End Sub

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


EventArgs) Handles btnlogin.Click
If txtuname.Text = "Bhumi" And txtpass.Text = "Parekh" Then
lbllogin.Text = "Login Successfully"
Else
lbllogin.Text = "Incorrect Username or Passwords"
End If

End Sub
 End Class

Page 3:- Greeting.ascx

<%@ Control Language="vb" AutoEventWireup="false"


CodeBehind="Greeting.ascx.vb" Inherits="USERCONTROLDEMO.Greeting"
%>

<fieldset>
<legend>Greeting Information </legend>
<br />
Enter Your Name :
<asp:TextBox ID="txtgreet" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="GREET USER" />
<br />
<br />
<asp:Label ID="lblgreet" runat="server"></asp:Label>
</fieldset>

Page 3.1:- Greeting.ascx.vb

Public Partial Class Greeting


Inherits System.Web.UI.UserControl

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


EventArgs) Handles Button1.Click
lblgreet.Text = "Welcome , " & txtgreet.Text
End Sub
End Class

[Type text] Page 35


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

17. GridView Demo.

Page1:- GridviewDemo.aspx

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="GridviewDemo.aspx.vb" Inherits="GridViewDemo1._Default"
%>

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div align="center">
<h1>....GRIDVIEW DEMO....</h1>
<asp:Button ID="Button1" runat="server" Text="SHOW INFORMATION"
/><br />
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False"
BackColor="White" BorderColor="White" BorderStyle="Ridge"
BorderWidth="2px"
CellPadding="3" CellSpacing="1" DataKeyNames="pid"
DataSourceID="AccessDataSource1" GridLines="None">
<RowStyle BackColor="#DEDFDE" ForeColor="Black" />
<Columns>
<asp:TemplateField HeaderText="PID">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("pid")
%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Description">
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%#
Eval("pname") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Mfg date">
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Eval("mfd")
%>'></asp:Label>

[Type text] Page 36


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Image">
<ItemTemplate>
<asp:Image ID="Image1" runat="server" Height="100px"
ImageUrl='<%# Eval("pimg") %>' Width="100px" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Action">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1"
runat="server">Edit</asp:LinkButton>
&nbsp;
<asp:LinkButton ID="LinkButton2" runat="server"
OnClientClick="return confirm('Do You Want To
Delete..??');">Delete</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>

</Columns>
<FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
<PagerStyle BackColor="#C6C3C6" ForeColor="Black"
HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#9471DE" Font-Bold="True"
ForeColor="White" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True"
ForeColor="#E7E7FF" />
</asp:GridView>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/prod_db.mdb" SelectCommand="SELECT *
FROM [tbl_product]">
</asp:AccessDataSource>
<br />

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

Page:-Gridviewdemo.aspx.vb

Partial Public Class _Default


Inherits System.Web.UI.Page

[Type text] Page 37


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

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


System.EventArgs) Handles Me.Load

End Sub

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


EventArgs) Handles Button1.Click
Dim plist As New ArrayList()
Dim p1 As New Product()
p1.pid = 1
p1.pname = "Mouse"
p1.mfd = "2 Jul 2018"
p1.pimg = "p1.jpg"
plist.Add(p1)

Dim p2 As New Product()


p2.pid = 2
p2.pname = "CPU"
p2.mfd = "21 Aug 2018"
p2.pimg = "~\\images\\p2.jpg"
plist.Add(p2)

Dim p3 As New Product()


p3.pid = 3
p3.pname = "Key Board"
p3.mfd = "5 Dec 2017"
p3.pimg = "~\\images\\p3.jpg"
plist.Add(p3)

Dim p4 As New Product()


p4.pid = 4
p4.pname = "Printer"
p4.mfd = "18 Apr 2017"
p4.pimg = "~\\images\\p4.jpg"
plist.Add(p4)

GridView1.DataSource = plist
GridView1.DataBind()

End Sub
End Class

Class1.vb

Public Class Product

[Type text] Page 38


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

Private _pid As Integer


Public Property pid() As Integer
Get
Return _pid
End Get
Set(ByVal value As Integer)
_pid = value
End Set
End Property

Private _pname As String


Public Property pname() As String
Get
Return _pname
End Get
Set(ByVal value As String)
_pname = value
End Set
End Property

Private _mfd As String


Public Property mfd() As String
Get
Return _mfd
End Get
Set(ByVal value As String)
_mfd = value
End Set
End Property

Private _pimg As String


Public Property pimg() As String
Get
Return _pimg
End Get
Set(ByVal value As String)
_pimg = value
End Set

[Type text] Page 39


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

End Property
End Class

OUTPUT:-

17(A). GridView Custom Demo.

Page:-CustomDemo.aspx

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="CustomDemo.aspx.vb"
Inherits="GRIDCUSTOMDEMO._Default" %>

<!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" >

[Type text] Page 40


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div align="center">
<h1>....GRIDVIEW CUSTOM DEMO....</h1>
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False"
DataKeyNames="pid" DataSourceID="AccessDataSource1">
<Columns>
<asp:CommandField ShowDeleteButton="True"
ShowEditButton="True" />
<asp:BoundField DataField="pid" HeaderText="pid"
ReadOnly="True"
SortExpression="pid" />
<asp:BoundField DataField="pname" HeaderText="pname"
SortExpression="pname" />
<asp:BoundField DataField="price" HeaderText="price"
SortExpression="price" />
<asp:BoundField DataField="mfd" HeaderText="mfd"
SortExpression="mfd" />
<asp:BoundField DataField="pimg" HeaderText="pimg"
SortExpression="pimg" />
</Columns>
</asp:GridView>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/prod_db.mdb" SelectCommand="SELECT *
FROM [tbl_product]"
DeleteCommand="DELETE FROM [tbl_prod] WHERE (([pid] = ?))"
InsertCommand="INSERT INTO [tbl_prod] ([pid], [pname], [price],
[qty], [photo]) VALUES (?, ?, ?, ?, ?)"
UpdateCommand="UPDATE [tbl_prod] SET [pname] = ?, [price] = ?,
[qty] = ?, [photo] = ? WHERE (([pid] = ?))">
<DeleteParameters>
<asp:Parameter Name="pid" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="pname" Type="String" />
<asp:Parameter Name="price" Type="Int32" />
<asp:Parameter Name="qty" Type="Int32" />
<asp:Parameter Name="photo" Type="String" />
<asp:Parameter Name="pid" Type="Int32" />
</UpdateParameters>
<InsertParameters>

[Type text] Page 41


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

<asp:Parameter Name="pid" Type="Int32" />


<asp:Parameter Name="pname" Type="String" />
<asp:Parameter Name="price" Type="Int32" />
<asp:Parameter Name="qty" Type="Int32" />
<asp:Parameter Name="photo" Type="String" />
</InsertParameters>
</asp:AccessDataSource>
</div>
</form>
</body>
</html>
Page:-Prod.vb

Public Class prod


Private _pid As Integer
Public Property pid() As Integer
Get
Return _pid
End Get
Set(ByVal value As Integer)
_pid = value
End Set
End Property

Private _pname As String


Public Property pname() As String
Get
Return _pname
End Get
Set(ByVal value As String)
_pname = value
End Set
End Property

Private _mfd As String


Public Property mfd() As String
Get
Return _mfd
End Get
Set(ByVal value As String)
_mfd = value
End Set
End Property

Private _pimg As String

[Type text] Page 42


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

Public Property pimg() As String


Get
Return _pimg
End Get
Set(ByVal value As String)
_pimg = value
End Set
End Property
End Class
OUTPUT:-

18. DataList Custom Demo with Paging.

Page:- DatalistDemo.aspx

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="DatalistDemo.aspx.vb" Inherits="DataListDemo._Default" %>

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div align="center">
<h1>....DATALIST DEMO....</h1>
<asp:DataList ID="DataList1" runat="server" DataKeyField="pid"
DataSourceID="AccessDataSource1" BackColor="#CCCCCC"
BorderColor="#999999"
BorderStyle="Solid" BorderWidth="3px" CellPadding="4"
CellSpacing="2"

[Type text] Page 43


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

ForeColor="Black" GridLines="Both" RepeatDirection="Horizontal">


<FooterStyle BackColor="#CCCCCC" />
<ItemStyle BackColor="White" />
<SelectedItemStyle BackColor="#000099" Font-Bold="True"
ForeColor="White" />
<HeaderStyle BackColor="Black" Font-Bold="True"
ForeColor="White" />
<ItemTemplate>
pid:
<asp:Label ID="pidLabel" runat="server" Text='<%# Eval("pid") %>'
/>
<br />
pname:
<asp:Label ID="pnameLabel" runat="server" Text='<%#
Eval("pname") %>' />
<br />
price:
<asp:Label ID="priceLabel" runat="server" Text='<%# Eval("price")
%>' />
<br />
qty:
<asp:Label ID="qtyLabel" runat="server" Text='<%# Eval("qty") %>'
/>
<br />
image:
<asp:Image ID="Image1" runat="server" Height="100px"
ImageUrl='<%# Eval("image") %>' Width="100px" />
<br />
<br />
</ItemTemplate>
</asp:DataList>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/db_product.mdb" SelectCommand="SELECT
* FROM [tbl_prod]"
DeleteCommand="DELETE FROM [tbl_prod] WHERE (([pid] = ?) OR
([pid] IS NULL AND ? IS NULL))"
InsertCommand="INSERT INTO [tbl_prod] ([pid], [pname], [price],
[qty], [photo]) VALUES (?, ?, ?, ?, ?)"
UpdateCommand="UPDATE [tbl_prod] SET [pname] = ?, [price] = ?,
[qty] = ?, [photo] = ? WHERE (([pid] = ?) OR ([pid] IS NULL AND ? IS NULL))">
<DeleteParameters>
<asp:Parameter Name="pid" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="pname" Type="String" />

[Type text] Page 44


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

<asp:Parameter Name="price" Type="Int32" />


<asp:Parameter Name="qty" Type="Int32" />
<asp:Parameter Name="photo" Type="String" />
<asp:Parameter Name="pid" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="pid" Type="Int32" />
<asp:Parameter Name="pname" Type="String" />
<asp:Parameter Name="price" Type="Int32" />
<asp:Parameter Name="qty" Type="Int32" />
<asp:Parameter Name="photo" Type="String" />
</InsertParameters>
</asp:AccessDataSource>
<br />
</div>
</form>
</body>
</html>
 OUTPUT:-

19. Repeater Demo.

Page:-RepeaterDemo

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="RepeaterDemo.aspx.vb" Inherits="RepeaterDemo._Default" %>

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div align="center">

[Type text] Page 45


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

<h1>....REPEATER DEMO....</h1>
<asp:Repeater ID="Repeater1" runat="server"
DataSourceID="AccessDataSource1">
<HeaderTemplate>
<table border="1">
<tr>
<th>
Prod_ID
</th>
<th>
Prod_Name
</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("pid")
%>'></asp:Label>
</td>
<td>
<asp:Label ID="Label2" runat="server" Text='<%#
Eval("pname") %>'></asp:Label>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/db_product.mdb" SelectCommand="SELECT
* FROM [tbl_prod]">
</asp:AccessDataSource>
</div>
</form>
</body>
</html>

[Type text] Page 46


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT


20. FormView Demo With Paging.

Page:-FormviewDemo.aspx

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="FormViewDemo.aspx.vb"
Inherits="FormViewDemo01._Default" %>

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div align="center">
<h1>....FORMVIEW DEMO....</h1>
<asp:FormView ID="FormView1" runat="server" AllowPaging="True"
DataKeyNames="pid" DataSourceID="AccessDataSource1"
BackColor="White"
BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px"
CellPadding="4"
ForeColor="Black" GridLines="Vertical">
<FooterStyle BackColor="#CCCC99" />
<RowStyle BackColor="#F7F7DE" />
<EditItemTemplate>
pid:
<asp:Label ID="pidLabel1" runat="server" Text='<%# Eval("pid")
%>' />
<br />
pname:
<asp:TextBox ID="pnameTextBox" runat="server" Text='<%#

[Type text] Page 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

Bind("pname") %>' />


<br />
price:
<asp:TextBox ID="priceTextBox" runat="server" Text='<%#
Bind("price") %>' />
<br />
qty:
<asp:TextBox ID="qtyTextBox" runat="server" Text='<%#
Bind("qty") %>' />
<br />
image:
<asp:TextBox ID="imageTextBox" runat="server" Text='<%#
Bind("image") %>' />
<br />
<asp:LinkButton ID="UpdateButton" runat="server"
CausesValidation="True"
CommandName="Update" Text="Update" />
&nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel"
Text="Cancel" />
</EditItemTemplate>
<InsertItemTemplate>
pid:
<asp:TextBox ID="pidTextBox" runat="server" Text='<%#
Bind("pid") %>' />
<br />
pname:
<asp:TextBox ID="pnameTextBox" runat="server" Text='<%#
Bind("pname") %>' />
<br />
price:
<asp:TextBox ID="priceTextBox" runat="server" Text='<%#
Bind("price") %>' />
<br />
qty:
<asp:TextBox ID="qtyTextBox" runat="server" Text='<%#
Bind("qty") %>' />
<br />
image:
<asp:TextBox ID="imageTextBox" runat="server" Text='<%#
Bind("image") %>' />
<br />
<asp:LinkButton ID="InsertButton" runat="server"
CausesValidation="True"
CommandName="Insert" Text="Insert" />

[Type text] Page 48


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

&nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server"


CausesValidation="False" CommandName="Cancel"
Text="Cancel" />
</InsertItemTemplate>
<ItemTemplate>
pid:
<asp:Label ID="pidLabel" runat="server" Text='<%# Eval("pid") %>'
/>
<br />
pname:
<asp:Label ID="pnameLabel" runat="server" Text='<%#
Bind("pname") %>' />
<br />
price:
<asp:Label ID="priceLabel" runat="server" Text='<%# Bind("price")
%>' />
<br />
qty:
<asp:Label ID="qtyLabel" runat="server" Text='<%# Bind("qty") %>'
/>
<br />
image:
<asp:Image ID="Image1" runat="server" Height="100px"
ImageUrl='<%# Eval("image")%>'
Width="100px" />
<br />
<asp:LinkButton ID="EditButton" runat="server"
CausesValidation="False"
CommandName="Edit" Text="Edit" />
&nbsp;<asp:LinkButton ID="DeleteButton" runat="server"
CausesValidation="False"
CommandName="Delete" Text="Delete" />
&nbsp;<asp:LinkButton ID="NewButton" runat="server"
CausesValidation="False"
CommandName="New" Text="New" />
</ItemTemplate>
</asp:FormView>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/db_product.mdb" SelectCommand="SELECT
* FROM [tbl_prod]"
DeleteCommand="DELETE FROM [tbl_prod] WHERE (([pid] = ?) OR
([pid] IS NULL AND ? IS NULL))"
InsertCommand="INSERT INTO [tbl_prod] ([pid], [pname], [price],
[qty], [image]) VALUES (?, ?, ?, ?, ?)"
UpdateCommand="UPDATE [tbl_prod] SET [pname] = ?, [price] = ?,

[Type text] Page 49


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

[qty] = ?, [image] = ? WHERE (([pid] = ?) OR ([pid] IS NULL AND ? IS NULL))">


<DeleteParameters>
<asp:Parameter Name="pid" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="pname" Type="String" />
<asp:Parameter Name="price" Type="Int32" />
<asp:Parameter Name="qty" Type="Int32" />
<asp:Parameter Name="image" Type="String" />
<asp:Parameter Name="pid" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="pid" Type="Int32" />
<asp:Parameter Name="pname" Type="String" />
<asp:Parameter Name="price" Type="Int32" />
<asp:Parameter Name="qty" Type="Int32" />
<asp:Parameter Name="image" Type="String" />
</InsertParameters>
</asp:AccessDataSource>
</div>
</form>
</body>
</html>

 OUTPUT:-

22. Cookie Demo.

Page:-Cookie.aspx

<%@ Page Language="vb" AutoEventWireup="false"

[Type text] Page 50


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

CodeBehind="Cookie.aspx.vb" Inherits="COOKIEDEMO._Default" %>

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<div id="msgdiv" runat="server">
<asp:Label ID="Label1" runat="server"></asp:Label>
</div>
<div id="txtdiv" runat="server">
Name :
<asp:TextBox ID="txtname" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="btnsignup" runat="server" Text="Create Cookie" />
</div>
</div>
</form>
</body>
</html>

Page:- Cookie.aspx.vb

Partial Public Class _Default


Inherits System.Web.UI.Page

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


System.EventArgs) Handles Me.Load
Dim httpCookie As HttpCookie = Request.Cookies("UserInfo")
If httpCookie Is Nothing Then
txtdiv.Visible = True
Else
msgdiv.Visible = True
End If
End Sub

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


EventArgs) Handles btnsignup.Click
Dim httpCookie As New HttpCookie("UserInfo")

[Type text] Page 51


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

httpCookie.Values.Add("ClientName", txtname.Text)
httpCookie.Expires = DateTime.Now.AddDays(1)
Response.Cookies.Add(httpCookie)
Response.Redirect("Welcome.aspx?name=" & txtname.Text)
End Sub
End Class

Page:- WELCOME.aspx

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="WELCOME.aspx.vb" Inherits="COOKIEDEMO.WELCOME" %>

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
Welcome To Our Website : <asp:Label ID="lblname" runat="server"
Text=""></asp:Label>
</div>
</form>
</body>
</html>

Page:- WELCOME.aspx.vb

Public Partial Class WELCOME


Inherits System.Web.UI.Page

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


System.EventArgs) Handles Me.Load
lblname.Text = Request.QueryString("name")
End Sub

End Class

23. ViewState Demo 1 ( Request Increament ).

Page:- RequestIncrement.aspx

[Type text] Page 52


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="RequestIncrement.aspx.vb"
Inherits="VIEWSTATEDEMO1._Default" %>

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div align="center">
<h1>...VIEWSTATE FIRST DEMO....</h1>
<asp:Button ID="Button1" runat="server" Text="Button" /><br /><br
/>
<asp:Label ID="Label1" runat="server" Text="AFTER CLICK ON
BUTTON THE VALUE WILL BE INCREMENTED BY 1"></asp:Label>
</div>
</form>
</body>
</html>

 RequestIncrement.aspx.vb

Partial Public Class _Default


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(ByVal sender As Object, ByVal e As


EventArgs) Handles Button1.Click
Dim cnt As Integer
If (ViewState("counter") Is Nothing) Then
cnt = 1
Else
cnt = CType(ViewState("counter"), Integer) + 1
End If

[Type text] Page 53


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

ViewState("counter") = cnt
Label1.Text = "counter:" & cnt.ToString()
End Sub
End Class

 OUTPUT:-

24. CrossPage Posting using Two Page.

Page:-1 CrossPage1.aspx

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="CrossPage1.aspx.vb"
Inherits="CrossPagePostingDemo._Default" %>

<!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>This is my CrossPage Demo</title>
</head>
<body>
<form id="form1" runat="server">
<div align="center">
<h1>...CrossPageDemo...</h1>
First Name:
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br /><br
/>
Last Name:
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br /><br
/>
<asp:LinkButton ID="LinkButton1" runat="server"
text="CrossPostBack"
PostBackUrl="~/CrossPage2.aspx"></asp:LinkButton>

[Type text] Page 54


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

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

 Page2:-Crosspage1.aspx.vb

Partial Public Class _Default


Inherits System.Web.UI.Page

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


System.EventArgs) Handles Me.Load

End Sub
Public ReadOnly Property Fullname() As String
Get
Return TextBox1.Text & " " & TextBox2.Text
End Get
End Property
End Class

 Page3:-Crosspage2.aspx

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="CrossPage2.aspx.vb"
Inherits="CrossPagePostingDemo.CrossPage2"%>

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>

[Type text] Page 55


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

</html>

Page4:-Crosspage2.aspx.vb

Public Partial Class CrossPage2


Inherits System.Web.UI.Page

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


System.EventArgs) Handles Me.Load
If PreviousPage IsNot Nothing Then
Label1.Text = "You Came From Default Page Title:" &
PreviousPage.Title
Dim prev As _Default
prev = TryCast(PreviousPage, _Default)
If prev IsNot Nothing Then
Label1.Text &= "<br/> You Type: " & prev.Fullname
End If
End If
End Sub

End Class

OUTPUT:-

25. QueryString Demo.

Page1:-QueryStringSender.aspx

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="QueryStringSender.aspx.vb"
Inherits="QueryStringDemo._Default" %>

<!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>Untitled Page</title>
</head>
<body>

[Type text] Page 56


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

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


<div>
<asp:ListBox ID="ListBox1" runat="server"></asp:ListBox><br /><br
/>
<asp:CheckBox ID="CheckBox1" runat="server" Text="Show Full
Details" /><br /><br />
<asp:Button ID="Button1" runat="server" Text="View Information" />
<br />
<br />
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
</div>
</form>
</body>
</html>

QueryStringSender.aspx.vb

Partial Public Class _Default


Inherits System.Web.UI.Page

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


System.EventArgs) Handles Me.Load
If Not IsPostBack Then
ListBox1.Items.Add("Econo Sofa")
ListBox1.Items.Add("Wheel Chair")
ListBox1.Items.Add("Daining Table")
ListBox1.Items.Add("Table")
End If
End Sub

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


EventArgs) Handles Button1.Click
If ListBox1.SelectedIndex = -1 Then
Label1.Text = "ERROR"
Else
Dim url As String = "QueryStringReceiver.aspx?" & "Item=" &
ListBox1.SelectedItem.Text & " Mode= " & CheckBox1.Checked.ToString()
Response.Redirect(url)
End If
End Sub
End Class

Page2:-QueryStringReceiver.aspx

<%@ Page Language="vb" AutoEventWireup="false"

[Type text] Page 57


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

CodeBehind="QueryStringReceiver.aspx.vb"
Inherits="QueryStringDemo.QueryStringReceiver" %>

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>

QueryStringReceiver.aspx.vb

Public Partial Class QueryStringReceiver


Inherits System.Web.UI.Page

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


System.EventArgs) Handles Me.Load
Label1.Text = "Item:" & Request.QueryString("Item")
Label1.Text &= "<br />" & Request.QueryString("Mode")
End Sub
End Class

 OUTPUT:-

[Type text] Page 58


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

26. Session Demo.

Page1:-Login.aspx

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="Login.aspx.vb" Inherits="SESSIONDEMO.Login" %>

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div align="center">
<h2>....LOGIN....</h2>
USERNAME:
<asp:TextBox ID="txtuname" runat="server"></asp:TextBox>
<br /><br />
PASSWORD :
<asp:TextBox ID="txtpass" runat="server"
TextMode="Password"></asp:TextBox>
<br /><br />
<asp:Button ID="Button1" runat="server" Text="LOGIN" Width="77px"
/>
&nbsp;
</div>
</form>
</body>
</html>

Page2:-Login.aspx.vb

Public Partial Class Login


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(ByVal sender As Object, ByVal e As


EventArgs) Handles Button1.Click

[Type text] Page 59


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

If txtuname.Text = "Bhumi Kishan" And txtpass.Text = "Parekh" Then


Session("UserName") = txtuname.Text
Session("Password") = txtpass.Text
Response.Redirect("index.aspx")
Else
Session("UserName") = Nothing
Session("Password") = Nothing
End If
End Sub
End Class

Page3:- Session1.vb

Public Class Session1


Inherits System.Web.UI.Page

Protected Overloads Sub Oninit(ByVal e As System.EventArgs)


If Session("UserName") = Nothing And Session("Password") = Nothing
Then
Response.Redirect("Login.aspx")
End If
End Sub
End Class

Page4:- Index.aspx

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="Index.aspx.vb" Inherits="SESSIONDEMO.Index" %>

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div align="center">
<h1>....INDEX PAGE...</h1>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<br /><br />
<asp:LinkButton ID="LinkButton1"
runat="server">LOGOUT</asp:LinkButton>
</div>

[Type text] Page 60


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

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

Page5:- Index.aspx.vb

Partial Public Class Index


Inherits Session1
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Label1.Text = "WELCOME...!" & Session("UserName")
End Sub

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


EventArgs) Handles LinkButton1.Click
Session.Abandon()
Response.Redirect("Login.aspx")
End Sub
End Class

27. Insert, Update, Delete and Display using Connected of ADO.NET.

Page:-Form1.aspx

Imports System.Data.OleDb
Public Class Form1
Dim cmd As New OleDbCommand()
Dim cn As New
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Users\kkk\Documents\Visual Studio
2008\Projects\Dbase_stud.mdb")
Dim rd As OleDbDataReader
Dim gen As Boolean

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Try
cn.Open()
cmd.Connection = cn
cmd.CommandText = "insert into tbl_student values(" &
CInt(TextBox1.Text) & ",'" & TextBox2.Text & "','" & TextBox3.Text & "', '" &
TextBox4.Text & "'," & CInt(TextBox5.Text) & ")"
cmd.ExecuteNonQuery()
MessageBox.Show(" Record Saved")

[Type text] Page 61


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
cn.Close()
End Try
'display()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
Try
cn.Open()
cmd.Connection = cn
cmd.CommandText = "update tbl_student set sname='" &
TextBox2.Text & "',address='" & TextBox3.Text & "',city='" & TextBox4.Text &
"',pincode='" & TextBox5.Text & "' where sid=" & CInt(TextBox1.Text) & ""
cmd.ExecuteNonQuery()
MessageBox.Show("Updated")
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
cn.Close()
End Try
display()
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load
display()
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click
Try
cn.Open()
cmd.Connection = cn
cmd.CommandText = "delete from tbl_student where sid=" &
CInt(TextBox1.Text) & ""
cmd.ExecuteNonQuery()
MessageBox.Show("Deleted")
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
cn.Close()
End Try

[Type text] Page 62


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

display()
End Sub
Public Sub display()
DataGridView1.Rows.Clear()
DataGridView1.Columns.Clear()
Try
cn.Open()
cmd.Connection = cn
cmd.CommandText = "select * from tbl_student order by sid desc"
rd = cmd.ExecuteReader()
DataGridView1.Columns.Add("c1", "Id")
DataGridView1.Columns.Add("c2", "Name")
DataGridView1.Columns.Add("c3", "Address")
DataGridView1.Columns.Add("c4", "City")
DataGridView1.Columns.Add("c5", "Pincode")
While rd.Read()
DataGridView1.Rows.Add(rd(0).ToString(), rd(1).ToString(),
rd(2).ToString(), rd(3).ToString(), rd(4).ToString())
End While
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
cn.Close()
End Try
End Sub
End Class

OUTPUT:-

[Type text] Page 63


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

28. Insert, Update, Delete and Display using DisConnected of ADO.NET.

Page:-WebForm1.aspx

Imports System.Data.OleDb
Public Class Form1
Dim cn As New
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Users\kkk\Documents\Visual Studio
2008\Projects\Dbase_stud.mdb")
Dim cmd As New OleDbCommand()
Dim rd As OleDbDataReader
Dim da As OleDbDataAdapter
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Try
cn.Open()
cmd.Connection = cn
cmd.CommandText = "insert into tbl_student values(" &
CInt(TextBox1.Text) & ",'" & TextBox2.Text & "','" & TextBox3.Text & "','" &
TextBox4.Text & "'," & CInt(TextBox5.Text) & ")"
cmd.ExecuteNonQuery()
MessageBox.Show("RECORD SAVED")
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
cn.Close()
End Try
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
Try
cn.Open()
cmd.Connection = cn
cmd.CommandText = "update tbl_student set sname='" &
TextBox2.Text & "',address='" & TextBox3.Text & "',city='" & TextBox4.Text &
"',pincode=" & CInt(TextBox4.Text) & " where sid=" & CInt(TextBox1.Text) &
""
cmd.ExecuteNonQuery()
MessageBox.Show("UPDATED")
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
cn.Close()

[Type text] Page 64


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

End Try
display()
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click
Try
cn.Open()
cmd.Connection = cn
cmd.CommandText = "delete from tbl_student where sid=" &
CInt(TextBox1.Text) & ""
cmd.ExecuteNonQuery()
MessageBox.Show("DELETED")
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
cn.Close()
End Try
display()
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load
display()
End Sub
Public Sub display()
Dim ds As New DataSet
da = New OleDbDataAdapter("select* from tbl_student order by sid
desc", cn)
da.Fill(ds)
ComboBox1.DataSource = Nothing
ComboBox1.DataSource = ds.Tables(0)
ComboBox1.DisplayMember = "sname"
ComboBox1.ValueMember = "sid"
'While rd.Read()
'DataGridView1.Rows.Add(rd(0).ToString(), rd(1).ToString(),
rd(2).ToString(), rd(3).ToString(), rd(4).ToString())
' End While
End Sub
End Class

OUTPUT:-

[Type text] Page 65


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

29. Apply Theme and Skin.

Page1:-WebForm1.aspx

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="WebForm1.aspx.vb"
Inherits="ThemeAndSkinDemo.WebForm1" %>

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>Select Item</asp:ListItem>
<asp:ListItem>Blue</asp:ListItem>
<asp:ListItem>Red</asp:ListItem>
</asp:DropDownList>
<br /><br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br /><br
/>
<asp:Button ID="Button1" runat="server" Text="Button" /><br />
<asp:Image ID="Image1" runat="server" />
</div>
</form>

[Type text] Page 66


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

</body>
</html>

Page2:-Red.Master

<%@ Master Language="VB" AutoEventWireup="false"


CodeBehind="Red.master.vb" Inherits="ThemeAndSkinDemo.Red" %>

<!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>Untitled Page</title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>

 Page3:-Blue.Master

<%@ Master Language="VB" AutoEventWireup="false"


CodeBehind="Blue.master.vb" Inherits="ThemeAndSkinDemo.Blue" %>

<!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>Untitled Page</title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">

[Type text] Page 67


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>

Page3:-Skin1.skin:Blue

<%--
Default skin template. The following skins are provided as examples only.

1. Named control skin. The SkinId should be uniquely defined because


duplicate SkinId's per control type are not allowed in the same theme.

<asp:GridView runat="server" SkinId="gridviewSkin" BackColor="White" >


<AlternatingRowStyle BackColor="Blue" />
</asp:GridView>

2. Default skin. The SkinId is not defined. Only one default


control skin per control type is allowed in the same theme.

<asp:Image runat="server" ImageUrl="~/images/image1.jpg" />


--%>
<asp:TextBox runat="server" forecolor="White" backcolor="Blue"
></asp:TextBox>
<asp:Button runat="server" Text="Button" forecolor="White"
backcolor="Blue" />

Page4:-Skin1.skin:Red

<%--
Default skin template. The following skins are provided as examples only.

1. Named control skin. The SkinId should be uniquely defined because


duplicate SkinId's per control type are not allowed in the same theme.

<asp:GridView runat="server" SkinId="gridviewSkin" BackColor="White" >


<AlternatingRowStyle BackColor="Blue" />
</asp:GridView>

2. Default skin. The SkinId is not defined. Only one default


control skin per control type is allowed in the same theme.

[Type text] Page 68


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

<asp:Image runat="server" ImageUrl="~/images/image1.jpg" />


--%>
<asp:TextBox runat="server" forecolor="Yellow"
backcolor="Red"></asp:TextBox>
<asp:Button runat="server" Text="Button" forecolor="Yellow"
backcolor="Red" />

page5:-Stylesheet1.css:Blue

body
{
background-color:Blue
}

Page6:- Stylesheet1.css:Red

body
{
background-color:Red
}

 OUTPUT:-

30. Apply Any Two Ajax Concept.

Page:-1. Ajaxdemo1.aspx

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="Ajaxdemo1.aspx.vb" Inherits="AJAXDEMO._Default" %>

[Type text] Page 69


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager><br />
<asp:Timer ID="Timer1" runat="server" Interval="1000">
</asp:Timer><br />
<asp:UpdatePanel runat="server">
<Triggers>
<asp:AsyncPostBackTrigger controlID="timer1"
EventName="Tick"/>
</Triggers>
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
 AJAXDEMO:-02

Page:-01.AjaxDemo2.aspx

<%@ Page Language="vb" AutoEventWireup="false"


CodeBehind="Ajaxdemo2.aspx.vb" Inherits="AJAXDEMO.Ajaxdemo2" %>

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>

[Type text] Page 70


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

<asp:ScriptManager ID="ScriptManager1" runat="server">


</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Enter
UserName"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br
/>
<asp:Button ID="Button1" runat="server" Text="GreetUser" />
<asp:Label ID="Label2" runat="server"
Text="Label"></asp:Label><br />
<asp:UpdateProgress ID="UpdateProgress1" runat="server"
AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<asp:Image ID="Image1" runat="server" />
</ProgressTemplate>
</asp:UpdateProgress>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
 AjaxDemo2.aspx.vb

Public Partial Class Ajaxdemo2


Inherits System.Web.UI.Page

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


EventArgs) Handles Button1.Click
System.Threading.Thread.Sleep(3000)
Label2.Text = "Welcome..! " & TextBox1.Text
End Sub
End Class

OUTPUT:-

[Type text] Page 71


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

MINI PROJECT

[Type text] Page 72


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

LOGIN.ASPX

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


Inherits="sem5journal.login" MasterPageFile="~/Site1.Master"%>
<asp:Content ID="content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
<fieldset>
<legend>Login</legend>
<center>
<table border="2">
<tr>
<th colspan="3">
Login
</th>
</tr>
<tr>
<td><asp:Label ID="Label1" runat="server"
Text="Username"></asp:Label></td>
<td>:</td>
<td><asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox></td>
</tr>
<tr>
<td><asp:Label ID="Label2" runat="server"
Text="Password"></asp:Label></td>
<td>:</td>
<td><asp:TextBox ID="TextBox2" runat="server"
TextMode="Password"></asp:TextBox></td>
</tr>
<tr>

[Type text] Page 73


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

<th colspan="3">
<asp:Button ID="Button1" runat="server" Text="Log In"
/>
<asp:Button ID="Button2" runat="server" Text="Cancel"
/>
</th>
</tr>
<tr>
<td colspan="3"><asp:Label ID="lblmsg" runat="server"
Text="Label"></asp:Label></td>
</tr>
</table>
</center>
</fieldset>
</asp:Content>

LOGIN.ASPX.VB

Public Partial Class login


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(ByVal sender As Object, ByVal e As


EventArgs) Handles Button1.Click
If TextBox1.Text = "udit" And TextBox2.Text = "123" Then
lblmsg.Text = "<font color='blue'>Login sucessfully</font>"
Response.Redirect("hello.aspx")
Else
lblmsg.Text = "<font color='red'>Login failed</font>"
TextBox1.Text = String.Empty
TextBox2.Text = String.Empty
TextBox1.Focus()
End If
End Sub

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


EventArgs) Handles Button2.Click
TextBox1.Text = " "
TextBox2.Text = ""
TextBox1.Focus()
End Sub
End Class

[Type text] Page 74


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

MINI PROJECT

SITE1.MASTER

<%@ Master Language="VB" AutoEventWireup="false"


CodeBehind="Site1.master.vb" Inherits="sem5journal.Site1" %>

<!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" >


<link rel="stylesheet" href="css/w3.css">
<link rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Oswald">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open
Sans">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/4.7.0/css/font-awesome.min.css">

<head id="Head1" runat="server">


<title>made by udit</title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
<style>
h1,h2,h3,h4,h5,h6 {font-family: "Oswald"}
body {font-family: "Open Sans"}
</style>

</head>
<body class="w3-light-pink">

[Type text] Page 75


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

<!-- Navigation bar with social media icons -->


<div class="w3-bar w3-cyan w3-hide-small">
<a href="#" class="w3-bar-item w3-button"><i class="fa fa-facebook-
official"></i></a>
<a href="#" class="w3-bar-item w3-button"><i class="fa fa-
instagram"></i></a>
<a href="#" class="w3-bar-item w3-button"><i class="fa fa-
snapchat"></i></a>
<a href="#" class="w3-bar-item w3-button"><i class="fa fa-
flickr"></i></a>
<a href="#" class="w3-bar-item w3-button"><i class="fa fa-
twitter"></i></a>
<a href="#" class="w3-bar-item w3-button"><i class="fa fa-
linkedin"></i></a>
<!--<a href="#" class="w3-bar-item w3-button w3-right"><i class="fa fa-
search"></i></a>-->
<a href="#" class="w3-bar-item w3-button w3-right"><i class="fa fa-
phone"></i> +91 8128186165</a>
<a href="#" class="w3-bar-item w3-button w3-right"><i class="fa fa-
envelope"></i>uditmistry207@gmail.com</a>
</div>

<!-- w3-content defines a container for fixed size centered content,


and is wrapped around the whole page content, except for the footer in this
example -->
<div class="w3-content" style="max-width:1600px">

<!-- Header style="background-image:url('images/hbg1.jpg')" -->


<div class="w3-container w3-center w3-padding-48" style="background-
image:url('images/hbg1.jpg');">

<h1 class="w3-xxxlarge"><b><font color="red">ASP.NET Mine


Project</font></b></h1>
<h6>Welcome to <span class="w3-tag">My Project</span></h6>

</div>

<!-- Navbar -->


<div class="w3-row w3-padding w3-border">
<div class="w3-center">
<div class="w3-bar w3-cyan w3-hide-big">
<a class="w3-bar-item w3-button w3-hide-medium w3-hide-large w3-right w3-
hover-white w3-theme-d2" href="javascript:void(0);" onclick="openNav()"><i
class="fa fa-bars"></i></a>
<a href="#" class="w3-bar-item w3-button w3-teal"><i class="fa fa-home
w3-margin-right"></i>Logo</a>
<a href="home.aspx"class="w3-bar-item w3-button w3-hide-small w3-hover-
white">program 1 to 10</a>
<a href="contols.aspx"class="w3-bar-item w3-button w3-hide-small w3-hover-
white">program 11 to 25</a>

<a href="connection.aspx"class="w3-bar-item w3-button w3-hide-small w3-


hover-white">program 26 to 30</a>

<a href="#contact" class="w3-bar-item w3-button w3-hide-small w3-hover-


white">About Us</a>

[Type text] Page 76


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

<div class="w3-dropdown-hover w3-hide-small">


<button class="w3-button" title="Notifications">Mine project<i
class="fa fa-caret-down"></i></button>
<div class="w3-dropdown-content w3-card-4 w3-bar-block">
<!--<a href="patient.aspx"class="w3-bar-item w3-button">Patient</a>--
>
<a href="doctor.aspx"class="w3-bar-item w3-button">Watch</a>
</div>
</div>
</div>
<a href="#" class="w3-bar-item w3-button w3-hide-small w3-right w3-hover-
teal" title="Search"><i class="fa fa-search"></i></a>
</div>

<!-- Navbar on small screens -->


<div id="navDemo" class="w3-bar-block w3-theme-d2 w3-hide w3-hide-large
w3-hide-medium">
<a href="#team" class="w3-bar-item w3-button">About College</a>
<a href="#work" class="w3-bar-item w3-button">Our Faculty</a>
<a href="#pricing" class="w3-bar-item w3-button">Events</a>
<a href="#pricing" class="w3-bar-item w3-button">Service</a>
<a href="#pricing" class="w3-bar-item w3-button">Product</a>
<a href="#contact" class="w3-bar-item w3-button">Contact</a>
<a href="#" class="w3-bar-item w3-button">Search</a>
</div>
</div>

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


<center>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</center>
</form>
<footer class="w3-container w3-dark-grey" style="padding:32px">
<a href="#" class="w3-button w3-black w3-padding-large w3-margin-
bottom"><i class="fa fa-arrow-up w3-margin-right"></i>To the top</a>
<p>Powered by abcdcompany. Developed By <a
href="https://drronakpanchal.wordpress.com" target="_blank">Udit Jenil
Kevin</a></p>

</footer>

<script>
// Toggle between hiding and showing blog replies/comments
document.getElementById("myBtn").click();
function myFunction(id) {
var x = document.getElementById(id);
if (x.className.indexOf("w3-show") == -1) {
x.className += " w3-show";
} else {
x.className = x.className.replace(" w3-show", "");
}
}

function likeFunction(x) {

[Type text] Page 77


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

x.style.fontWeight = "bold";
x.innerHTML = "✓ Liked";
}
</script>
<script>
// Script for side navigation
function w3_open() {
var x = document.getElementById("mySidebar");
x.style.width = "300px";
x.style.paddingTop = "10%";
x.style.display = "block";
}

// Close side navigation


function w3_close() {
document.getElementById("mySidebar").style.display = "none";
}

// Used to toggle the menu on smaller screens when clicking on the menu
button
function openNav() {
var x = document.getElementById("navDemo");
if (x.className.indexOf("w3-show") == -1) {
x.className += " w3-show";
} else {
x.className = x.className.replace(" w3-show", "");
}
}
</script>

<script>
var myIndex = 0;
carousel();

function carousel() {
var i;
var x = document.getElementsByClassName("mySlides");
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
myIndex++;
if (myIndex > x.length) {myIndex = 1}
x[myIndex-1].style.display = "block";
setTimeout(carousel, 9000);
}
</script>
<script>
function myMap() {
var mapOptions = {
center: new google.maps.LatLng(21.1253338, 73.1086546),
zoom: 10,
mapTypeId: google.maps.MapTypeId.HYBRID
}
var map = new google.maps.Map(document.getElementById("map"), mapOptions);
}
</script>

[Type text] Page 78


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: ASP
JOURNAL
MADE BY UDIT

<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBu-
916DdpKAjTmJNIgngS6HL_kDIKU0aU&callback=myMap"></script>
</body>
</html>

[Type text] Page 79

Вам также может понравиться