Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
11 views33 pages

Q.1 Create The Registration Form Using Tabular Format and When User Submit The Form Display Data in A Separate Panel On The Same Page. Design

The document contains a series of ASP.NET projects, including a registration form that displays user data upon submission, a panel display based on selected radio buttons, and a MultiView control showcasing different views on a single webpage. Each project includes source code and design elements, demonstrating how to implement user input forms and dynamic content display. The projects are structured for educational purposes, likely for a programming course.

Uploaded by

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

Q.1 Create The Registration Form Using Tabular Format and When User Submit The Form Display Data in A Separate Panel On The Same Page. Design

The document contains a series of ASP.NET projects, including a registration form that displays user data upon submission, a panel display based on selected radio buttons, and a MultiView control showcasing different views on a single webpage. Each project includes source code and design elements, demonstrating how to implement user input forms and dynamic content display. The projects are structured for educational purposes, likely for a programming course.

Uploaded by

satkaival1712
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 33

TYBCA DIV-3 Journal ASP .

NET(506)

Q.1 Create the Registration form using tabular format and when user submit the form
display data in a separate panel on the same page.
Design:

Sabale snehal b. : 182 PAGE:1


TYBCA DIV-3 Journal ASP .NET(506)
Source:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Registration
form.aspx.vb" Inherits="Registration_form" %>

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


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

</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td><h1> Students Information</h1></td>
</tr>
<tr>
<td class="style1">
<asp:Label ID="Label1" runat="server" Text="Name"></asp:Label>
:</td>
<td class="style2">
<asp:TextBox ID="txtname" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="E-mail"></asp:Label>:</td>
<td class="style3">
<asp:TextBox ID="txtemail" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
<asp:Label ID="Label3" runat="server" Text="Address"></asp:Label>:</td>
<td class="style3">
<asp:TextBox ID="txtaddress" runat="server"
TextMode="MultiLine"></asp:TextBox></td>
</tr>
<tr>
<td><asp:Label ID="Label4" runat="server" Text="Password"></asp:Label>:</td>
<td class="style3">
<asp:TextBox ID="txtpwd" runat="server"
TextMode="Password"></asp:TextBox></td>
</tr>
<tr>
<td><asp:Label ID="Label12" runat="server" Text="Confirm
Password"></asp:Label>:</td>
<td class="style3">
<asp:TextBox ID="txtcpwd" runat="server"
TextMode="Password"></asp:TextBox>
</td>
</tr>
<tr>

Sabale snehal b. : 182 PAGE:2


TYBCA DIV-3 Journal ASP .NET(506)

<td class="style4"><asp:Label ID="Label5" runat="server"


Text="Gender"></asp:Label>:</td>

<td class="style5">
<asp:RadioButtonList ID="radio_gender" runat="server">
<asp:ListItem>Male</asp:ListItem>
<asp:ListItem>Female</asp:ListItem>
</asp:RadioButtonList>
</td>

</tr>
<tr>
<td style="font-size: small">
<asp:Label ID="Label6" runat="server" Text="Hobby"></asp:Label>:</td>
<td class="style3">
<asp:CheckBoxList ID="chkbox_hobby" runat="server">
<asp:ListItem>Reading</asp:ListItem>
<asp:ListItem>Dancing</asp:ListItem>
<asp:ListItem>Singing</asp:ListItem>
</asp:CheckBoxList>
</td>
</tr>

<tr>
<td colspan="2" align="center">
<asp:Button ID="btnsubmit" runat="server" Text="Submit"
onclick="btnsubmit_Click" />

<asp:Button ID="btnreset" runat="server" Text="Reset"


onclick="btnreset_Click" /></td>
</tr>
<tr>
<td colspan="2">
<asp:Panel ID="Panel1" runat="server" Visible="False">
<asp:Label ID="Label7" runat="server"
Text="Name"></asp:Label>:&nbsp;&nbsp;
<asp:Label ID="lblname" runat="server" Text="Label"></asp:Label><br />
<asp:Label ID="Label8" runat="server"
Text="Email"></asp:Label>:&nbsp;&nbsp;
<asp:Label ID="lblemail" runat="server" Text="Label"></asp:Label><br />
<asp:Label ID="Label9" runat="server"
Text="Address"></asp:Label>:&nbsp;&nbsp;
<asp:Label ID="lbladdress" runat="server" Text="Label"></asp:Label><br />
<asp:Label ID="Label10" runat="server" Text="Gender"></asp:Label>:&nbsp;
<asp:Label ID="lblgender" runat="server" Text="Label"></asp:Label><br />
<asp:Label ID="Label11" runat="server"
Text="Hobby"></asp:Label>:&nbsp;&nbsp;
<asp:Label ID="lblhobby" runat="server" Text="Label"></asp:Label>

</asp:Panel>

Sabale snehal b. : 182 PAGE:3


TYBCA DIV-3 Journal ASP .NET(506)
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

Code:

Partial Class Default2


Inherits System.Web.UI.Page

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


Handles btnsubmit.Click
Panel1.Visible = True
Dim i As Integer
Dim gen As String
For i = 0 To radio_gender.Items.Count - 1
If radio_gender.Items(i).Selected Then
gen = radio_gender.Items(i).ToString
End If
Next
Dim str As String = ""
For i = 0 To chkbox_hobby.Items.Count - 1
If chkbox_hobby.Items(i).Selected Then
str += chkbox_hobby.Items(i).Text + " "
End If
Next
lblname.Text = txtname.Text
lblemail.Text = txtemail.Text
lbladdress.Text = txtaddress.Text
lblgender.Text = radio_gender.Text
lblhobby.Text = chkbox_hobby.Text
End Sub

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


Handles btnreset.Click
txtname.Text = ""
txtemail.Text = ""
txtaddress.Text = ""
txtpwd.Text = ""
txtcpwd.Text = ""
radio_gender.ClearSelection()
chkbox_hobby.ClearSelection()
End Sub
End Class

Sabale snehal b. : 182 PAGE:4


TYBCA DIV-3 Journal ASP .NET(506)
Output:

Sabale snehal b. : 182 PAGE:5


TYBCA DIV-3 Journal ASP .NET(506)
Q.2 Create the webpage using panel according to the following criteria. Whatever radio
button user is selecting according to that appropriate panel should be displayed.
Design:

Source:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Snehal_panel.aspx.vb"
Inherits="Snehal_panel" %>

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


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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:RadioButton ID="rbtnoption1" runat="server" Text="Option 1"
GroupName="Options" AutoPostBack="true"
OnCheckedChanged="rbtn_CheckedChanged"/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:RadioButton ID="rbtnoption2" runat="server" Text="Option 2"
GroupName="Options" AutoPostBack="true"
OnCheckedChanged="rbtn_CheckedChanged"/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:RadioButton ID="rbtnoption3" runat="server" Text="Option 3"
GroupName="Options" AutoPostBack="true"
OnCheckedChanged="rbtn_CheckedChanged"/>
<br />
<br />
<asp:Panel ID="Panel1" runat="server" Height="70px" Width="300px" Visible="false">
<h3>Panel for Option 1</h3>
<p>This is Panel 1.</p>

Sabale snehal b. : 182 PAGE:6


TYBCA DIV-3 Journal ASP .NET(506)
</asp:Panel>
<br />

<asp:Panel ID="Panel2" runat="server" Height="70px" Width="300px" Visible="false">


<h3>Panel for Option 2</h3>
<p>This is Panel 2.</p>
</asp:Panel>
<br />

<asp:Panel ID="Panel3" runat="server" Height="70px" Width="300px" Visible="false">


<h3>Panel for Option 3</h3>
<p>This is Panel 3.</p>
</asp:Panel>
<br />
</div>
</form>
</body>
</html>

Code:

Partial Class Snehal_panel


Inherits System.Web.UI.Page

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


System.EventArgs) Handles rbtnoption1.CheckedChanged
Panel1.Visible = False
Panel2.Visible = False
Panel3.Visible = False

If (rbtnoption1.Checked) Then
Panel1.Visible = True
End If
If (rbtnoption2.Checked) Then
Panel2.Visible = True
End If
If (rbtnoption3.Checked) Then
Panel3.Visible = True
End If
End Sub
End Class

Sabale snehal b. : 182 PAGE:7


TYBCA DIV-3 Journal ASP .NET(506)
Output:

Sabale snehal b. : 182 PAGE:8


TYBCA DIV-3 Journal ASP .NET(506)
Q.3 Create the webpage using Multiview Control and display 3 different views on a single
web page.
Design:

Sabale snehal b. : 182 PAGE:9


TYBCA DIV-3 Journal ASP .NET(506)
Source:
<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="Snehal_Multiview.aspx.vb" Inherits="Snehal_Multiview" %>

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


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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.style1
{
height: 23px;
}
.style2
{
height: 23px;
width: 123px;
}
.style3
{
width: 123px;
}
.style4
{
width: 125px;
}
.style5
{
width: 125px;
height: 23px;
}
.style6
{
height: 23px;
width: 130px;
}
.style7
{
width: 130px;
}
.style8
{
width: 123px;
height: 21px;
}
.style9
{
height: 21px;
}

Sabale snehal b. : 182 PAGE:10


TYBCA DIV-3 Journal ASP .NET(506)
.style10
{
width: 123px;
height: 26px;
}
.style11
{
height: 26px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:MultiView ID="MultiView1" runat="server">

<asp:View ID="View1" runat="server">


<table style="width:100%;">
<tr>
<td class="style2">
<asp:Label ID="Label3" runat="server" Text="Name : "></asp:Label>
</td>
<td class="style1">
<asp:TextBox ID="txtname" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style3">
<asp:Label ID="Label8" runat="server" Text="Age"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtage" runat="server"></asp:TextBox>
</td>

</tr>
<tr>
<td class="style10">
<asp:Label ID="Label14" runat="server" Text="Address"></asp:Label>
</td>
<td class="style11">
<asp:TextBox ID="txtadd" runat="server"></asp:TextBox>
</td>

</tr>
<tr>
<td class="style3">
<asp:Button ID="btnsub" runat="server" ForeColor="Black" Text="&gt;"
onclick="btnsub_Click" />
</td>
<td>

Sabale snehal b. : 182 PAGE:11


TYBCA DIV-3 Journal ASP .NET(506)
&nbsp;</td>
</tr>
</table>
</asp:View>
<asp:View ID="View2" runat="server">

<table style="width:100%;">
<tr>
<td class="style5">
<asp:Label ID="Label4" runat="server" Text="P.no"></asp:Label>
</td>
<td class="style1">
<asp:TextBox ID="txtno" runat="server"></asp:TextBox>
</td>

</tr>
<tr>
<td class="style5">
<asp:Label ID="Label5" runat="server" Text="Email"></asp:Label>
</td>
<td class="style1">
<asp:TextBox ID="txtemail" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style4">
<asp:Button ID="Button1" runat="server" Text="&lt;"
onclick="Button1_Click" />
</td>
<td>
<asp:Button ID="Button2" runat="server" Text="&gt;"
onclick="Button2_Click" />
</td>

</tr>
</table>

</asp:View>
<asp:View ID="View3" runat="server">
<table style="width:100%;">
<tr>
<td class="style6">
<asp:Label ID="Label6" runat="server" Text="Name"></asp:Label>
</td>
<td class="style1">
<asp:Label ID="lbname" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="style6">
<asp:Label ID="Label10" runat="server" Text="Age"></asp:Label>

Sabale snehal b. : 182 PAGE:12


TYBCA DIV-3 Journal ASP .NET(506)
</td>
<td class="style1">
<asp:Label ID="lbage" runat="server"></asp:Label>
</td>

</tr>
<tr>
<td class="style8">
<asp:Label ID="Label11" runat="server" Text="Address"></asp:Label>
</td>
<td class="style9">
<asp:Label ID="lbadd" runat="server"></asp:Label>
</td>

</tr>
<tr>
<td class="style3">
<asp:Label ID="Label12" runat="server" Text="P.no"></asp:Label>
</td>
<td>
<asp:Label ID="lbno" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="style3">
<asp:Label ID="Label13" runat="server" Text="Email"></asp:Label>
</td>
<td>
<asp:Label ID="lbemail" runat="server"></asp:Label>
</td>

</tr>
<tr>
<td class="style7">
<asp:Button ID="Button3" runat="server" Text="&lt;"
onclick="Button3_Click" />
</td>
<td>
<asp:Button ID="Button4" runat="server" Text="Submit"
onclick="Button4_Click" />
</td>

</tr>
</table>
<br />
</asp:View>
</asp:MultiView>
</div>
</form>
</body>
</html>

Sabale snehal b. : 182 PAGE:13


TYBCA DIV-3 Journal ASP .NET(506)
Code:

Partial Class Snehal_Multiview


Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
If IsPostBack = False Then
MultiView1.ActiveViewIndex = 0
End If
End Sub

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


Handles Button4.Click
lbname.Text = txtname.Text
lbage.Text = txtage.Text
lbadd.Text = txtadd.Text
lbno.Text = txtno.Text
lbemail.Text = txtemail.Text
End Sub

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


Handles btnsub.Click
MultiView1.ActiveViewIndex = 1
End Sub

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


Handles Button1.Click
MultiView1.ActiveViewIndex = 0
End Sub

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


Handles Button2.Click
MultiView1.ActiveViewIndex = 2
End Sub

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


Handles Button3.Click
MultiView1.ActiveViewIndex = 1
End Sub
End Class

Sabale snehal b. : 182 PAGE:14


TYBCA DIV-3 Journal ASP .NET(506)
Output:

Sabale snehal b. : 182 PAGE:15


TYBCA DIV-3 Journal ASP .NET(506)
Q.4 Create the Registration form using tabular format and when user submit the form store
data in a table. Also apply all the required validation controls and display appropriate
message.
Design:

Sabale snehal b. : 182 PAGE:16


TYBCA DIV-3 Journal ASP .NET(506)
Source:
<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="Snehal_Validationcontrol.aspx.vb" Inherits="Snehal_Vadisationcontrol" %>

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


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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form2" runat="server">
<div>
<table>
<tr>
<td align="center" colspan="2"><h1>Students Information</h1></td>
</tr>
<tr>
<td class="style1">
<asp:Label ID="Label1" runat="server" Text="Name"></asp:Label>
</td>
<td class="style2">
<asp:TextBox ID="txtname" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ErrorMessage="Name is Required"
ControlToValidate="txtname"></asp:RequiredFieldValidator>
</td>

</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="E-mail"></asp:Label></td>
<td class="style3">
<asp:TextBox ID="txtemail" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
<asp:Label ID="Label3" runat="server" Text="Address"></asp:Label></td>
<td class="style3">
<asp:TextBox ID="txtaddress" runat="server"
TextMode="MultiLine"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="txtaddress" ErrorMessage="Address is
Require"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label13" runat="server" Text="Age"></asp:Label>
</td>

Sabale snehal b. : 182 PAGE:17


TYBCA DIV-3 Journal ASP .NET(506)
<td class="style3">
<asp:TextBox ID="Txtage" runat="server"></asp:TextBox>
<asp:CompareValidator ID="CompareValidator2" runat="server"
ControlToValidate="Txtage" ErrorMessage="Age must be greater than 18"
Operator="GreaterThan" ValueToCompare="18"></asp:CompareValidator>
</td>
</tr>
<tr>
<td><asp:Label ID="Label4" runat="server" Text="Password"></asp:Label></td>
<td class="style3">
<asp:TextBox ID="txtpwd" runat="server" TextMode="Password"></asp:TextBox>
</td>
</tr>
<tr>
<td><asp:Label ID="Label12" runat="server" Text="Confirm
Password"></asp:Label></td>
<td class="style3">
<asp:TextBox ID="txtcpwd" runat="server"
TextMode="Password"></asp:TextBox>
<asp:CompareValidator ID="CompareValidator1" runat="server"
ControlToCompare="txtpwd" ControlToValidate="txtcpwd"
ErrorMessage="Password and Confirm password must be same">Password and
Confirm
password must be same</asp:CompareValidator>
</td>
</tr>
<tr>
<td><asp:Label ID="Label5" runat="server" Text="Gender"></asp:Label></td>

<td class="style3">
<asp:RadioButtonList ID="radio_gender" runat="server">
<asp:ListItem>Male</asp:ListItem>
<asp:ListItem>Female</asp:ListItem>
</asp:RadioButtonList>
</td>

</tr>
<tr>
<td style="font-size: small">
<asp:Label ID="Label6" runat="server" Text="Hobby"></asp:Label></td>
<td class="style3">
<asp:CheckBoxList ID="chkbox_hobby" runat="server">
<asp:ListItem>Reading</asp:ListItem>
<asp:ListItem>Writing</asp:ListItem>
<asp:ListItem>Singing</asp:ListItem>
<asp:ListItem>Dancing</asp:ListItem>
</asp:CheckBoxList>
</td>
</tr>

<tr>

Sabale snehal b. : 182 PAGE:18


TYBCA DIV-3 Journal ASP .NET(506)
<td colspan="2" align="center">
<asp:Button ID="btnsubmit" runat="server" Text="Submit"
onclick="btnsubmit_Click" />

<asp:Button ID="btnreset" runat="server" Text="Reset"


onclick="btnreset_Click" /></td>
</tr>
<tr>
<td colspan="2">
<asp:Panel ID="Panel1" runat="server" Visible="False">
<asp:Label ID="Label7" runat="server"
Text="Name"></asp:Label>&nbsp;&nbsp;&nbsp;
<asp:Label ID="lblname" runat="server" Text="Label"></asp:Label><br />
<asp:Label ID="Label8" runat="server"
Text="Email"></asp:Label>&nbsp;&nbsp;&nbsp;
<asp:Label ID="lblemail" runat="server" Text="Label"></asp:Label><br />
<asp:Label ID="Label9" runat="server"
Text="Address"></asp:Label>&nbsp;&nbsp;&nbsp;
<asp:Label ID="lbladdress" runat="server" Text="Label"></asp:Label><br />
<asp:Label ID="Label10" runat="server"
Text="Gender"></asp:Label>&nbsp;&nbsp;&nbsp;
<asp:Label ID="lblgender" runat="server" Text="Label"></asp:Label><br />
<asp:Label ID="Label11" runat="server"
Text="Hobby"></asp:Label>&nbsp;&nbsp;&nbsp;
<asp:Label ID="lblhobby" runat="server" Text="Label"></asp:Label>

</asp:Panel>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

Sabale snehal b. : 182 PAGE:19


TYBCA DIV-3 Journal ASP .NET(506)
Code:

Partial Class Snehal_Vadisationcontrol


Inherits System.Web.UI.Page

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


Handles btnsubmit.Click
Panel1.Visible = True
Dim i As Integer
Dim gen As String
For i = 0 To radio_gender.Items.Count - 1
If radio_gender.Items(i).Selected Then
gen = radio_gender.Items(i).ToString
End If
Next

Dim str As String = ""


For i = 0 To chkbox_hobby.Items.Count - 1
If chkbox_hobby.Items(i).Selected Then
str += chkbox_hobby.Items(i).Text + " "
End If
Next
lblname.Text = txtname.Text
lblemail.Text = txtemail.Text
lbladdress.Text = txtaddress.Text
lblgender.Text = radio_gender.Text
lblhobby.Text = str
End Sub

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


Handles btnreset.Click
txtname.Text = ""
txtemail.Text = ""
txtaddress.Text = ""
txtpwd.Text = ""
txtcpwd.Text = ""
radio_gender.ClearSelection()
chkbox_hobby.ClearSelection()
End Sub
End Class

Sabale snehal b. : 182 PAGE:20


TYBCA DIV-3 Journal ASP .NET(506)
Output:

Sabale snehal b. : 182 PAGE:21


TYBCA DIV-3 Journal ASP .NET(506)
Q.5 Create a web page to make the use of calendar control to select your birth date and
display it on the label.
Design:

Source:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Snehal_calender.aspx.vb"
Inherits="Snehal_calender" %>

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


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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Select your
birthday"></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td>
<td>
<asp:Calendar ID="Calendar1" runat="server"></asp:Calendar>
</td>
</tr>
</table>
<asp:Panel ID="Panel1" runat="server" Visible="false">
<table>
<tr>
<td>
<asp:Label ID="lbldate" runat="server"
Text="Date"></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td>

Sabale snehal b. : 182 PAGE:22


TYBCA DIV-3 Journal ASP .NET(506)

</tr>
</table>
</asp:Panel>
</div>
</form>
</body>
</html>

Code:

Partial Class Snehal_calender


Inherits System.Web.UI.Page

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


System.EventArgs) Handles Calendar1.SelectionChanged
Panel1.Visible = True
lbldate.Text = "selected birthday = " + Calendar1.SelectedDate.ToShortDateString()
End Sub
End Class

Output:

Sabale snehal b. : 182 PAGE:23


TYBCA DIV-3 Journal ASP .NET(506)
Q.6 Create a webpage that enables you to upload a file on the server.
Design:

Source:
<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="Snehal_fileupload.aspx.vb" Inherits="Snehal_fileupload" %>

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


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

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

<asp:FileUpload ID="FileUpload1" runat="server" />


<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Upload" />
&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

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

Code:

Sabale snehal b. : 182 PAGE:24


TYBCA DIV-3 Journal ASP .NET(506)
Partial Class Snehal_fileupload
Inherits System.Web.UI.Page

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


Handles Button1.Click
Dim dir As String = "\imp\"
Dim app_path As String = Request.PhysicalApplicationPath
If FileUpload1.HasFile = True Then
Dim save_path As String = app_path + dir +
Server.HtmlEncode(FileUpload1.FileName)
FileUpload1.SaveAs(save_path)
FileUpload1.SaveAs(save_path)
Label1.Text = "Uploaded Successfully"
Else
Label1.Text = "Not Uploaded Successfully"
End If
End Sub
End Class

Output:

Q.7 Create the web page that allows Insert, Update, Delete, View and Search operation in the

Sabale snehal b. : 182 PAGE:25


TYBCA DIV-3 Journal ASP .NET(506)
database. Data should be displayed in the Gridview. When user clicks on search button,
following web page should be displayed to the user, where user can search for data.
Searched data should be displayed in the Gridview.
Design:

Source:
<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="Snehal_gridview.aspx.vb" Inherits="Snehal_gridview" %>

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


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

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

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


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label2" runat="server" Text="Name"></asp:Label>

Sabale snehal b. : 182 PAGE:26


TYBCA DIV-3 Journal ASP .NET(506)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label3" runat="server" Text="City"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label4" runat="server" Text="Marks"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Insert" />
&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button2" runat="server" Text="Update" />
&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button3" runat="server" Text="Delete" />
&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button4" runat="server" Text="View" />
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>

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

Code:
Imports System.Data.SqlClient
Partial Class Snehal_gridview
Inherits System.Web.UI.Page
Dim con As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\
Users\SNEHAL\Documents\Visual Studio 2010\WebSites\WebSite7\App_Data\
Database.mdf;Integrated Security=True;User Instance=True")
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim str As String
str = "Insert into student values(" & TextBox1.Text & ", ' " & TextBox2.Text & " ',' " &
TextBox3.Text & " '," & TextBox4.Text & ")"
Dim cmd As New SqlCommand(str, con)
con.Open()
cmd.ExecuteNonQuery()
MsgBox("Record inserted successfully")
con.Close()
End Sub

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


Handles Button2.Click
Dim str As String

Sabale snehal b. : 182 PAGE:27


TYBCA DIV-3 Journal ASP .NET(506)

str = "update student set Name= ' " & TextBox2.Text & " ',City=' " & TextBox3.Text & "
',Marks= " & TextBox4.Text & " where RollNo= " & TextBox1.Text
Dim cmd As New SqlCommand(str, con)
con.Open()
cmd.ExecuteNonQuery()
MsgBox("Record updated successfully")
con.Close()
End Sub

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


Handles Button3.Click
Dim str As String
str = "Delete from student where RollNo= " & TextBox1.Text
Dim cmd As New SqlCommand(str, con)
con.Open()
cmd.ExecuteNonQuery()
MsgBox("Record deleted successfully")
con.Close()
End Sub

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


Handles Button4.Click
Dim str As String
str = "select * from student"
Dim cmd As New SqlCommand(str, con)
con.Open()
Dim da As New SqlDataAdapter(cmd)
Dim ds As New Data.DataSet
da.Fill(ds)
GridView1.DataSource = ds
GridView1.DataBind()
End Sub

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


Handles Button5.Click
Dim str As String
str = "select * from student where RollNo =" & TextBox1.Text & " "
Dim cmd As New SqlCommand(str, con)
con.Open()
Dim da As New SqlDataAdapter(cmd)
Dim ds As New Data.DataSet
da.Fill(ds)
GridView1.DataSource = ds
GridView1.DataBind()
End Sub
End Class

Output:

Sabale snehal b. : 182 PAGE:28


TYBCA DIV-3 Journal ASP .NET(506)

Sabale snehal b. : 182 PAGE:29


TYBCA DIV-3 Journal ASP .NET(506)

Sabale snehal b. : 182 PAGE:30


TYBCA DIV-3 Journal ASP .NET(506)

Q.8

Sabale snehal b. : 182 PAGE:31


TYBCA DIV-3 Journal ASP .NET(506)
Design:

Source:

Code:

Output:

Sabale snehal b. : 182 PAGE:32


TYBCA DIV-3 Journal ASP .NET(506)

Sabale snehal b. : 182 PAGE:33

You might also like