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
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
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:
</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>
<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:Panel>
Code:
Source:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Snehal_panel.aspx.vb"
Inherits="Snehal_panel" %>
<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"/>
<asp:RadioButton ID="rbtnoption2" runat="server" Text="Option 2"
GroupName="Options" AutoPostBack="true"
OnCheckedChanged="rbtn_CheckedChanged"/>
<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>
Code:
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
<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;
}
</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=">"
onclick="btnsub_Click" />
</td>
<td>
<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="<"
onclick="Button1_Click" />
</td>
<td>
<asp:Button ID="Button2" runat="server" Text=">"
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>
</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="<"
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>
<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>
<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>
</asp:Panel>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
Source:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Snehal_calender.aspx.vb"
Inherits="Snehal_calender" %>
<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>
</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>
</td>
</tr>
</table>
</asp:Panel>
</div>
</form>
</body>
</html>
Code:
Output:
Source:
<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="Snehal_fileupload.aspx.vb" Inherits="Snehal_fileupload" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div style="height: 197px">
</div>
</form>
</body>
</html>
Code:
Output:
Q.7 Create the web page that allows Insert, Update, Delete, View and Search operation in the
Source:
<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="Snehal_gridview.aspx.vb" Inherits="Snehal_gridview" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div style="height: 651px">
</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
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
Output:
Q.8
Source:
Code:
Output: