Você está na página 1de 63

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Roll No 86

RATHOD AJAY A.

TYBCA NGCCA

Unit:-1 Introduction
Que:-1 Create an application which count the total number of users visited the page. (Using global.asax). Global.asax
<%@ Application Language="VB" %> <script runat="server" Language="vb"> Public i As Integer = 1 Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) Application("NoOfVisitors") = 0 ' Code that runs on application startup End Sub Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs on application shutdown End Sub Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs when an unhandled error occurs End Sub Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) i += 1 Application.Lock() Application("NoOfVisitors") = CInt(Application("NoOfVisitors")) + 1 Application.UnLock() ' MsgBox(i) ' Code that runs when a new session is started End Sub Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs when a session ends. ' Note: The Session_End event is raised only when the sessionstate mode ' is set to InProc in the Web.config file. If session mode is set to StateServer ' or SQLServer, the event is not raised. End Sub

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

</script>

Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1transitional.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" FontBold="True" Font-Size="16pt" Height="27px" Text="Total Visit is" Width="185px"></asp:Label></div> </form> </body> </html>

Default.aspx.vb
Imports System Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Label1.Text = "Total Visit is " & Application("NoOfVisitors").ToString() End Sub End Class

Output

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Que:-2 Create web page which will display School mark sheet using table control.
Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div style="background-color:#85ccb9; width:520px; left: 8px; position: absolute; top: 10px; height:397px;"> <asp:Image ID="Image1" runat="server" Height="82px" ImageUrl="~/images/logo1.gif" Width="89px" style="zindex: 100; left: 3px; position: absolute; top: 4px" /> <div style="position:absolute; padding-left:100px; left: 0px; width: 398px; top: 7px; z-index: 101;" id="DIV1" onclick="return DIV1_onclick()"> <span style="font-size: 24pt">

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Chimanbhai Patel Institute <br/>Of Computer Apllication </span> </div > <br /> <br /> <br /> <br /> <asp:Table ID="Table1" runat="server" Style="z-index: 103; left: 6px; position: absolute; top: 93px;" BackColor="Transparent" BorderColor="Black" BorderWidth="1px" Width="502px" Font-Bold="true" > <asp:TableRow BorderWidth="1px" HorizontalAlign="Center" runat="server"> <asp:TableCell BorderWidth="1px" runat="server">Seat NO.<br/>380 </asp:TableCell> <asp:TableCell runat="server" BorderWidth="1px">Name. <br/> Jibin George </asp:TableCell> <asp:TableCell runat="server" BorderWidth="1px">Year.<br/>December 2013 </asp:TableCell> <asp:TableCell runat="server" BorderWidth="1px">Enrolment No.<br/>20111213337 </asp:TableCell> </asp:TableRow> </asp:Table> <asp:Table ID="Table2" runat="server" Style="z-index: 103; left: 7px; position: absolute; top: 139px;" BackColor="Transparent" BorderColor="Black" BorderWidth="1px" Width="501px" ForeColor="Black" > <asp:TableRow ID="TableRow1" Font-Bold="True" HorizontalAlign="Center" runat="server"> <asp:TableCell BorderWidth="1px" runat="server" RowSpan="2">Subject Name</asp:TableCell> <asp:TableCell runat="server" BorderWidth="1px" RowSpan="2">Cradit </asp:TableCell> <asp:TableCell runat="server" BorderWidth="1px" ColumnSpan="2" BorderStyle="None" >Marks </asp:TableCell>
<asp:TableCell runat="server" BorderWidth="1px" RowSpan="2">Totla </asp:TableCell> </asp:TableRow> <asp:TableRow ID="TableRow2" Font-Bold="True" BorderWidth="1px" HorizontalAlign="Center" runat="server" >

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

<asp:TableCell ID="TableCell3" runat="server" >Internal</asp:TableCell> <asp:TableCell ID="TableCell4" runat="server" >External </asp:TableCell> </asp:TableRow> <asp:TableRow ID="TableRow3" runat="server"> <asp:TableCell ID="TableCell1" HorizontalAlign="Left" BorderWidth="1px" runat="server" >C Programing</asp:TableCell> <asp:TableCell ID="TableCell2" HorizontalAlign="Center" runat="server" BorderWidth="1px"> 3 </asp:TableCell> <asp:TableCell ID="TableCell5" HorizontalAlign="Center" runat="server" BorderWidth="1px" BorderStyle="None" >29 </asp:TableCell> <asp:TableCell ID="TableCell7" HorizontalAlign="Center" runat="server" BorderWidth="1px" BorderStyle="None" >65 </asp:TableCell> <asp:TableCell ID="TableCell6" HorizontalAlign="Center" runat="server" BorderWidth="1px" >94 </asp:TableCell> </asp:TableRow> <asp:TableRow ID="TableRow4" runat="server"> <asp:TableCell ID="TableCell8" HorizontalAlign="Left" BorderWidth="1px" runat="server">Introduction to Internet and HTML</asp:TableCell> <asp:TableCell ID="TableCell9" HorizontalAlign="Center" runat="server" BorderWidth="1px" > 3 </asp:TableCell> <asp:TableCell ID="TableCell10" HorizontalAlign="Center" runat="server" BorderWidth="1px" BorderStyle="None" >30 </asp:TableCell> <asp:TableCell ID="TableCell11" HorizontalAlign="Center" runat="server" BorderWidth="1px" BorderStyle="None" >67 </asp:TableCell> <asp:TableCell ID="TableCell12" HorizontalAlign="Center" runat="server" BorderWidth="1px" >97 </asp:TableCell> </asp:TableRow> <asp:TableRow ID="TableRow5" runat="server"> <asp:TableCell ID="TableCell13" HorizontalAlign="Left" BorderWidth="1px" runat="server" >Basic Of Mathenatics</asp:TableCell> <asp:TableCell ID="TableCell14" HorizontalAlign="Center" runat="server" BorderWidth="1px" > 3 </asp:TableCell> <asp:TableCell ID="TableCell15" HorizontalAlign="Center" runat="server" BorderWidth="1px" BorderStyle="None" >25 </asp:TableCell> <asp:TableCell ID="TableCell16" HorizontalAlign="Center" runat="server" BorderWidth="1px" BorderStyle="None" >40 </asp:TableCell> <asp:TableCell ID="TableCell17" HorizontalAlign="Center" runat="server" BorderWidth="1px" >65 </asp:TableCell> </asp:TableRow> <asp:TableRow ID="TableRow6" runat="server"> <asp:TableCell ID="TableCell18" HorizontalAlign="Left" BorderWidth="1px" runat="server" >Computer Fondamentals</asp:TableCell>

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

<asp:TableCell ID="TableCell19" HorizontalAlign="Center" runat="server" BorderWidth="1px" > 3 </asp:TableCell> <asp:TableCell ID="TableCell20" HorizontalAlign="Center" runat="server" BorderWidth="1px" BorderStyle="None" >25 </asp:TableCell> <asp:TableCell ID="TableCell21" HorizontalAlign="Center" runat="server" BorderWidth="1px" BorderStyle="None" >55 </asp:TableCell> <asp:TableCell ID="TableCell22" HorizontalAlign="Center" runat="server" BorderWidth="1px" >80 </asp:TableCell> </asp:TableRow> <asp:TableRow ID="TableRow7" runat="server"> <asp:TableCell ID="TableCell23" HorizontalAlign="Left" BorderWidth="1px" runat="server" >C Programing Practicle</asp:TableCell> <asp:TableCell ID="TableCell24" HorizontalAlign="Center" runat="server" BorderWidth="1px" > 3 </asp:TableCell> <asp:TableCell ID="TableCell25" HorizontalAlign="Center" runat="server" BorderWidth="1px" BorderStyle="None" >30 </asp:TableCell> <asp:TableCell ID="TableCell26" HorizontalAlign="Center" runat="server" BorderWidth="1px" BorderStyle="None" >70 </asp:TableCell> <asp:TableCell ID="TableCell27" HorizontalAlign="Center" runat="server" BorderWidth="1px" >100 </asp:TableCell> </asp:TableRow> <asp:TableRow ID="TableRow8" runat="server"> <asp:TableCell ID="TableCell28" HorizontalAlign="Left" BorderWidth="1px" runat="server" >HTML Practicale</asp:TableCell> <asp:TableCell ID="TableCell29" HorizontalAlign="Center" runat="server" BorderWidth="1px" > 3 </asp:TableCell> <asp:TableCell ID="TableCell30" HorizontalAlign="Center" runat="server" BorderWidth="1px" BorderStyle="None" >30 </asp:TableCell> <asp:TableCell ID="TableCell31" HorizontalAlign="Center" runat="server" BorderWidth="1px" BorderStyle="None" >70 </asp:TableCell> <asp:TableCell ID="TableCell32" HorizontalAlign="Center" runat="server" BorderWidth="1px" >100 </asp:TableCell> </asp:TableRow> <asp:TableRow ID="TableRow9" runat="server" Font-Bold="True" ForeColor="Blue" > <asp:TableCell ID="TableCell33" HorizontalAlign="Left" BorderWidth="1px" runat="server" >Totle</asp:TableCell> <asp:TableCell ID="TableCell34" HorizontalAlign="Center" runat="server" BorderWidth="1px" > 18 </asp:TableCell> <asp:TableCell ID="TableCell35" HorizontalAlign="Center" runat="server" BorderWidth="1px" >169 </asp:TableCell> <asp:TableCell ID="TableCell36" HorizontalAlign="Center" runat="server" BorderWidth="1px" >367 </asp:TableCell> <asp:TableCell ID="TableCell37" HorizontalAlign="Center" runat="server" BorderWidth="1px" >536 </asp:TableCell>

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

</asp:TableRow> </asp:Table> </div> </form> </body> </html>

Output

Que : 3 Create web page which will ask the employee personal detail, education detail, work experience detail with use different panel for each part . Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_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" >

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

<div> &nbsp;&nbsp; <asp:Panel ID="Panel1" runat="server" style="z-index: 100; left: 22px; position: absolute; top: 15px" BorderColor="#66ffcc" Height="167px" Width="385px"> <asp:Table ID="Table1" runat="server" style="z-index: 100; left: 18px; position: absolute; top: 31px" Height="110px" HorizontalAlign="Left" Width="341px"> <asp:TableRow runat="server"> <asp:TableCell runat="server"> Emp Name :</asp:TableCell> <asp:TableCell runat="server"> <asp:TextBox ID="empname" runat="server"></asp:TextBox></asp:TableCell> </asp:TableRow> <asp:TableRow runat="server"> <asp:TableCell runat="server"> Emp Age :</asp:TableCell> <asp:TableCell runat="server"> <asp:TextBox ID="empage" runat="server"></asp:TextBox></asp:TableCell> </asp:TableRow> <asp:TableRow runat="server"> <asp:TableCell runat="server"> Emp Date OF Birth :</asp:TableCell> <asp:TableCell runat="server"> <asp:TextBox ID="dob" runat="server"></asp:TextBox></asp:TableCell> </asp:TableRow> </asp:Table> &nbsp;<strong><span style="color: blueviolet"> Employee Personal Detail</span></strong></asp:Panel> <asp:Panel ID="Panel2" runat="server" style="z-index: 100; left: 23px; position: absolute; top: 382px" Height="167px" Width="381px"> <asp:Table ID="Table2" runat="server" style="z-index: 100; left: 18px; position: absolute; top: 31px" Height="110px" HorizontalAlign="Left" Width="296px"> <asp:TableRow runat="server"> <asp:TableCell runat="server"> SSC Percentage :</asp:TableCell> <asp:TableCell runat="server"> <asp:TextBox ID="ssc" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow ID="TableRow1" runat="server"> <asp:TableCell ID="TableCell1" runat="server"> Year to pass SSC :</asp:TableCell> <asp:TableCell ID="TableCell2" runat="server"> <asp:TextBox ID="sscyear" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow runat="server"> <asp:TableCell runat="server"> HSC Percentage :</asp:TableCell> <asp:TableCell runat="server"> <asp:TextBox ID="hsc" runat="server"></asp:TextBox> </asp:TableCell>

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

</asp:TableRow> <asp:TableRow ID="TableRow2" runat="server"> <asp:TableCell ID="TableCell3" runat="server"> Year to pass HSC :</asp:TableCell> <asp:TableCell ID="TableCell4" runat="server"> <asp:TextBox ID="hscyear" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> </asp:Table> &nbsp;<strong><span style="color: blueviolet"> Employee Education Detail</span></strong></asp:Panel> <asp:Panel ID="Panel3" runat="server" style="z-index: 100; left: 24px; position: absolute; top: 200px" Height="167px" Width="382px"> <asp:Table ID="Table3" runat="server" style="z-index: 100; left: 18px; position: absolute; top: 31px" Height="110px" HorizontalAlign="Left" Width="337px"> <asp:TableRow runat="server"> <asp:TableCell runat="server"> Post of Last job</asp:TableCell> <asp:TableCell runat="server"> <asp:TextBox ID="lst_job" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow runat="server"> <asp:TableCell runat="server"> Number Of Munth</asp:TableCell> <asp:TableCell runat="server"> <asp:TextBox ID="munth" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow runat="server"> <asp:TableCell runat="server"> Leave Date of Last Job:</asp:TableCell> <asp:TableCell runat="server"> <asp:TextBox ID="leave_job" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> </asp:Table> &nbsp;<span style="color: blueviolet"><strong> Employee Experience Detail</strong></span></asp:Panel> </div> </form> </body> </html>

Output

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Que : 4 Create web page which will ask payment detail of custome purchase, this detail either in Cash or Credit/Debit card or by Cheque. According to the payment mode panel control will display and accept payment detail and display all that detail in next page using label control. Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_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> <asp:Panel ID="Panel1" runat="server" Height="182px" Style="zindex: 100; left: 13px; position: absolute; top: 51px" Width="320px"> <asp:Label ID="Label1" runat="server" Style="z-index: 102; left: 12px; position: absolute; top: 12px" Text="Cheque Details:"></asp:Label>

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

<asp:Button ID="Button1" runat="server" Style="z-index: 100; left: 21px; position: absolute; top: 145px" Text="Submit" /> <asp:Label ID="Label2" runat="server" Style="z-index: 101; left: 5px; position: absolute; top: 50px" Text="Cheque Number"></asp:Label> <asp:Label ID="Label3" runat="server" Style="z-index: 102; left: 6px; position: absolute; top: 78px" Text="Cheque Ex-date"></asp:Label> <asp:Label ID="Label4" runat="server" Style="z-index: 103; left: 6px; position: absolute; top: 105px" Text="Amount"></asp:Label> <asp:TextBox ID="TextBox1" runat="server" Style="z-index: 104; left: 129px; position: absolute; top: 48px"></asp:TextBox> <asp:TextBox ID="TextBox2" runat="server" Style="z-index: 105; left: 129px; position: absolute; top: 78px"></asp:TextBox> <asp:TextBox ID="TextBox3" runat="server" Style="z-index: 107; left: 130px; position: absolute; top: 107px"></asp:TextBox> </asp:Panel> <asp:Panel ID="Panel2" runat="server" Height="182px" Style="zindex: 101; left: 13px; position: absolute; top: 51px" Width="320px"> <asp:Label ID="Label5" runat="server" Style="z-index: 102; left: 6px; position: absolute; top: 12px" Text="Credit/Debit card Details:"></asp:Label> <asp:Button ID="Button2" runat="server" Style="z-index: 100; left: 21px; position: absolute; top: 145px" Text="Submit" /> <asp:Label ID="Label6" runat="server" Style="z-index: 101; left: 5px; position: absolute; top: 50px" Text="Credit/Debi Number"></asp:Label> <asp:Label ID="Label7" runat="server" Style="z-index: 102; left: 6px; position: absolute; top: 78px" Text="Credit/Debit Ex-date"></asp:Label> <asp:Label ID="Label8" runat="server" Style="z-index: 103; left: 6px; position: absolute; top: 105px" Text="Amount"></asp:Label> <asp:TextBox ID="TextBox4" runat="server" Style="z-index: 104; left: 137px; position: absolute; top: 48px"></asp:TextBox> <asp:TextBox ID="TextBox5" runat="server" Style="z-index: 105; left: 137px; position: absolute; top: 78px"></asp:TextBox> <asp:TextBox ID="TextBox6" runat="server" Style="z-index: 107; left: 136px; position: absolute; top: 107px"></asp:TextBox> </asp:Panel><asp:Panel ID="Panel3" runat="server" Height="182px" Style="z-index: 102; left: 13px; position: absolute; top: 51px" Width="320px">

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

<asp:Label ID="Label9" runat="server" Style="z-index: 102; left: 6px; position: absolute; top: 12px" Text="Case Details:"></asp:Label> <asp:Button ID="Button3" runat="server" Style="z-index: 100; left: 21px; position: absolute; top: 145px" Text="Submit" /> <asp:Label ID="Label10" runat="server" Style="z-index: 101; left: 5px; position: absolute; top: 50px" Text="Total amount Of coine"></asp:Label> <asp:Label ID="Label11" runat="server" Style="z-index: 102; left: 6px; position: absolute; top: 78px" Text="Total amount of silak"></asp:Label> <asp:Label ID="Label12" runat="server" Style="z-index: 103; left: 6px; position: absolute; top: 105px" Text="Total Amount"></asp:Label> <asp:TextBox ID="TextBox7" runat="server" Style="z-index: 104; left: 142px; position: absolute; top: 48px"></asp:TextBox> <asp:TextBox ID="TextBox8" runat="server" Style="z-index: 105; left: 141px; position: absolute; top: 78px"></asp:TextBox> <asp:TextBox ID="TextBox9" runat="server" Style="z-index: 107; left: 141px; position: absolute; top: 107px"></asp:TextBox> </asp:Panel> <asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True" RepeatColumns="3"Style="z-index: 104; left: 9px; position: absolute; top: 7px" Width="406px"> <asp:ListItem>Case payment</asp:ListItem> <asp:ListItem>Credit/Debit payment</asp:ListItem> <asp:ListItem>Cheque payment</asp:ListItem> </asp:RadioButtonList> </div> </form> </body> </html>

Default.aspx.vb
Partial Class _Default Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Application("ch_no") = TextBox1.Text Application("ch_exdate") = TextBox2.Text Application("amount") = TextBox3.Text Application("panal") = 3 Response.Redirect("Default2.aspx") End Sub Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click Application("Credit_no") = TextBox4.Text Application("Credit_exdate") = TextBox5.Text Application("amount") = TextBox6.Text

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Application("panal") = 2 Response.Redirect("Default2.aspx") End Sub Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click Application("coine") = TextBox7.Text Application("silak") = TextBox8.Text Application("amount") = TextBox9.Text Application("panal") = 1 Response.Redirect("Default2.aspx") End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Panel1.Visible = False Panel2.Visible = False Panel3.Visible = False End Sub Protected Sub RadioButtonList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButtonList1.SelectedIndexChanged If RadioButtonList1.SelectedIndex = 0 Then Panel3.Visible = True Panel1.Visible = False Panel2.Visible = False ElseIf RadioButtonList1.SelectedIndex = 1 Then Panel2.Visible = True Panel1.Visible = False Panel3.Visible = False Else Panel1.Visible = True Panel2.Visible = False Panel3.Visible = False End If End Sub End Class

Default2.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %> <!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:Panel ID="Panel1" runat="server" Height="182px" Style="zindex: 100; left: 21px; position: absolute; top: 39px" Width="320px">

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

<asp:Label ID="Label1" runat="server" Style="z-index: 100; left: 12px; position: absolute; top: 12px" Text="Cheque Details:"></asp:Label> &nbsp; <asp:Label ID="Label2" runat="server" Style="z-index: 102; left: 5px; position: absolute; top: 50px" Text="Cheque Number"></asp:Label> <asp:Label ID="Label3" runat="server" Style="z-index: 103; left: 6px; position: absolute; top: 78px" Text="Cheque Ex-date"></asp:Label> <asp:Label ID="Label4" runat="server" Style="z-index: 104; left: 6px; position: absolute; top: 105px" Text="Amount"></asp:Label> &nbsp; &nbsp; <asp:Label ID="Label13" runat="server" Style="z-index: 105; left: 139px; position: absolute; top: 48px" Text="Label"></asp:Label> <asp:Label ID="Label14" runat="server" Style="z-index: 106; left: 141px; position: absolute; top: 76px" Text="Label"></asp:Label> <asp:Label ID="Label15" runat="server" Style="z-index: 108; left: 141px; position: absolute; top: 105px" Text="Label"></asp:Label> </asp:Panel> <asp:Panel ID="Panel2" runat="server" Height="182px" Style="zindex: 101; left: 19px; position: absolute; top: 38px" Width="320px"> <asp:Label ID="Label5" runat="server" Style="z-index: 100; left: 6px; position: absolute; top: 12px" Text="Credit/Debit card Details:"></asp:Label> &nbsp; <asp:Label ID="Label19" runat="server" Style="z-index: 101; left: 174px; position: absolute; top: 51px" Text="Label"></asp:Label> <asp:Label ID="Label20" runat="server" Style="z-index: 102; left: 175px; position: absolute; top: 77px" Text="Label"></asp:Label> <asp:Label ID="Label21" runat="server" Style="z-index: 107; left: 176px; position: absolute; top: 104px" Text="Label"></asp:Label> <asp:Label ID="Label6" runat="server" Style="z-index: 104; left: 5px; position: absolute; top: 50px" Text="Credit/Debi Number"></asp:Label> <asp:Label ID="Label7" runat="server" Style="z-index: 105; left: 6px; position: absolute; top: 78px" Text="Credit/Debit Ex-date"></asp:Label> <asp:Label ID="Label8" runat="server" Style="z-index: 106; left: 6px; position: absolute; top: 105px" Text="Amount"></asp:Label> &nbsp; &nbsp; </asp:Panel><asp:Panel ID="Panel3" runat="server" Height="182px" Style="z-index: 102; left: 21px; position: absolute; top: 37px" Width="320px">

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

<asp:Label ID="Label9" runat="server" Style="z-index: 100; left: 6px; position: absolute; top: 12px" Text="Case Details:"></asp:Label> &nbsp; <asp:Label ID="Label10" runat="server" Style="z-index: 101; left: 5px; position: absolute; top: 50px" Text="Total amount Of coine"></asp:Label> <asp:Label ID="Label11" runat="server" Style="z-index: 102; left: 6px; position: absolute; top: 78px" Text="Total amount of silak"></asp:Label> <asp:Label ID="Label12" runat="server" Style="z-index: 103; left: 6px; position: absolute; top: 105px" Text="Total Amount"></asp:Label> &nbsp; &nbsp; <asp:Label ID="Label16" runat="server" Style="z-index: 104; left: 169px; position: absolute; top: 51px" Text="Label"></asp:Label> <asp:Label ID="Label17" runat="server" Style="z-index: 105; left: 170px; position: absolute; top: 79px" Text="Label"></asp:Label> <asp:Label ID="Label18" runat="server" Style="z-index: 107; left: 170px; position: absolute; top: 107px" Text="Label"></asp:Label> </asp:Panel> </div> </form> </body> </html>

Default2.aspx.vb
Partial Class Default2 Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Panel1.Visible = False Panel2.Visible = False Panel3.Visible = False If Application("panal") = "1" Then Panel3.Visible = True Label16.Text = Application("coine") Label17.Text = Application("silak") Label18.Text = Application("amount") ElseIf Application("panal") = "2" Then Panel2.Visible = True Label19.Text = Application("Credit_no") Label20.Text = Application("Credit_exdate") Label21.Text = Application("amount") ElseIf Application("panal") = "3" Then Panel1.Visible = True Label13.Text = Application("ch_no") Label14.Text = Application("ch_exdate") Label15.Text = Application("amount")

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

End If End Sub End Class

Output

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Que : 5 Write a program that displays a label in green color and it should change into yellow when the mouse moves over it. Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_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"> a.chng_lab{background-color : green;} a:hover.chng_lab {background-color : yellow;} </style> </head> <body> <form id="form1" runat="server"> <div> <a class="chng_lab"> <asp:Label ID="Label1" runat="server" Height="16px" Text="This is label" Width="10%" CssClass="a"></asp:Label> </a></div> </form> </body> </html>

Output

Unit:-2 Web Controls

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Que:-1 Write a simple ASP.NET program to display the following Web Controls: A button with text click me. The button control must be in the center of the form. A label with a text hello A checkbox. The form name must be Web Controls. Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_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"> <asp:Button ID="Button1" runat="server" Text="CLICK ME!" /> <br/> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </div> <div> <asp:Panel ID="Panel1" runat="server" Style="z-index: 100; left: 35%; position: absolute; top: 20%" Height="15%" Width="39%"> <br /> <asp:Label ID="Label2" runat="server" Text="Label">Select File Name</asp:Label> <br /> <asp:CheckBox ID="CheckBox1" runat="server" Text="First" Width="23%" AutoPostBack="True" /> <asp:CheckBox ID="CheckBox2" runat="server" Text="Second" Width="25%" AutoPostBack="True" /> <asp:CheckBox ID="CheckBox3" runat="server" Text="Third" Width="23%" AutoPostBack="True" /> <asp:CheckBox ID="CheckBox4" runat="server" Text="Forth" Width="25%" AutoPostBack="True" /> </asp:Panel> </div> </form> </body> </html>

Default.aspx.vb

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Partial Class _Default Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Label1.Text = "HELLO" End Sub Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged, CheckBox2.CheckedChanged, CheckBox3.CheckedChanged, CheckBox4.CheckedChanged If sender.text = "First" Then Me.Title = "First" CheckBox2.Checked = False CheckBox3.Checked = False CheckBox4.Checked = False ElseIf sender.text = "Second" Then Me.Title = "Second" CheckBox1.Checked = False CheckBox3.Checked = False CheckBox4.Checked = False ElseIf sender.text = "Third" Then Me.Title = "Third" CheckBox1.Checked = False CheckBox2.Checked = False CheckBox4.Checked = False Else Me.Title = "Forth" CheckBox1.Checked = False CheckBox2.Checked = False CheckBox3.Checked = False End If End Sub End Class

Output :

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Que : 2 Write a program to display Hello World in the form when the click button is clicked. The Form title must be ASP.NET. Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_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> <asp:Button ID="Button1" runat="server" Style="z-index: 100; left: 5px; position: absolute; top: 10px; " Text="Click Me" /> </div> </form> </body> </html>

Default.aspx.vb

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Partial Class _Default Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Me.Title = "Hello World" End Sub End Class

Que : 3 Write a program containing the following controls: A ListBox A Button An Image A Label The listbox is used to list items available in a store. When the user clicks on an item in the listbox, its image is displayed in the image control. When the user clicks the button, the cost of the selected item is displayed in the control.

Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_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"> <H2> <span style="color: #000099">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Books</span></H2> <div>

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

<asp:ListBox ID="ListBox1" runat="server" Height="84px" Style="z-index: 100; left: 18px; position: absolute; top: 53px" Width="189px" AutoPostBack="true" > <asp:ListItem Value="420">C balagurusamy</asp:ListItem> <asp:ListItem Value="400">C++ balagurusamy</asp:ListItem> <asp:ListItem Value="525">beginning java4</asp:ListItem> <asp:ListItem Value="500">Beginning Android4</asp:ListItem> <asp:ListItem Value="510">PHP</asp:ListItem> <asp:ListItem Value="600">Asp.net Black Book</asp:ListItem> </asp:ListBox> <asp:Image ID="Image1" runat="server" Height="154px" Style="zindex: 101; left: 96px; position: absolute; top: 198px" Width="128px" /> <asp:Label ID="Label1" runat="server" Style="z-index: 104; left: 9px; position: absolute; top: 219px" Text="Price :: "></asp:Label> <asp:Button ID="Button1" runat="server" Style="z-index: 103; left: 18px; position: absolute; top: 335px" Text="Show Price Of the Item" /> </div> </form> </body> </html>

Default.aspx.vb
Partial Class _Default Inherits System.Web.UI.Page Protected Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged Label1.Text = "Price ::" If ListBox1.SelectedIndex = 0 Then Image1.ImageUrl = "Images\c.gif" ElseIf ListBox1.SelectedIndex = 1 Then Image1.ImageUrl = "~\Images\cpp.jpg" ElseIf ListBox1.SelectedIndex = 2 Then Image1.ImageUrl = "~\Images\java.jpg" ElseIf ListBox1.SelectedIndex = 3 Then Image1.ImageUrl = "~\Images\android.jpg" ElseIf ListBox1.SelectedIndex = 4 Then Image1.ImageUrl = "~\Images\php.jpg" ElseIf ListBox1.SelectedIndex = 5 Then Image1.ImageUrl = "~\Images\asp.jpg" End If End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Label1.Text += " " & ListBox1.SelectedValue End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub End Class

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Output

Que:- 4 Extend the above program to add the following controls: Two labels A TextBox A Button One of the labels is displayed adjacent to the textbox, displaying the message Enter the quantity: When the user enters the quantity in the textbox and clicks the button, the total cost is evaluated and displayed in another label.

Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_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> <asp:Label ID="Label1" runat="server" Style="z-index: 100; left: 48px; position: absolute; top: 80px" Text="Enter the Quantity" ForeColor="#400000"></asp:Label>

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

<asp:Label ID="Label2" runat="server" Style="z-index: 101; left: 152px; position: absolute; top: 184px" ForeColor="#400000"></asp:Label> <asp:TextBox ID="TextBox1" runat="server" Style="z-index: 102; left: 184px; position: absolute; top: 80px"></asp:TextBox> <asp:Button ID="Button1" runat="server" Style="z-index: 104; left: 136px; position: absolute; top: 136px" Text="Total Cost" BackColor="#FFC0C0" ForeColor="#400000" /> </div> </form> </body> </html>

Default.aspx.vb
Partial Class _Default Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Label2.Text = Val(TextBox1.Text) * 100 End Sub End Class

Output

Que : 5 Create a RadioButtonList that displays the names of some flowers in two columns. Bind a label to the RadioButtonList so that when the user selects an option from the list and clicks on a button, the label displays the flower selected by the user.

Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

<!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:RadioButtonList ID="RadioButtonList1" runat="server" CellPadding="2" CellSpacing="2"Height="22px" RepeatColumns="2" Style="z-index: 100; left: 12px; position: absolute; top: 16px" Width="253px" AutoPostBack ="true" > <asp:ListItem>Lisianthus</asp:ListItem> <asp:ListItem>peony</asp:ListItem> <asp:ListItem>poinsettia</asp:ListItem> <asp:ListItem>protea</asp:ListItem> <asp:ListItem>rose</asp:ListItem> <asp:ListItem>sunflower</asp:ListItem> </asp:RadioButtonList> <asp:Image ID="Image1" runat="server" Style="z-index: 102; left: 22px; position: absolute; top: 138px" /> </div> </form> </body> </html>

Default.aspx.vb
Partial Class _Default Inherits System.Web.UI.Page Protected Sub RadioButtonList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButtonList1.SelectedIndexChanged If RadioButtonList1.SelectedIndex = 0 Then Image1.ImageUrl = "Images\Lisianthus.jpg" ElseIf RadioButtonList1.SelectedIndex = 1 Then Image1.ImageUrl = "Images\peony.jpg" ElseIf RadioButtonList1.SelectedIndex = 2 Then Image1.ImageUrl = "Images\poinsettia.jpg" ElseIf RadioButtonList1.SelectedIndex = 3 Then Image1.ImageUrl = "Images\protea.jpg" ElseIf RadioButtonList1.SelectedIndex = 4 Then Image1.ImageUrl = "Images\rose.jpg" ElseIf RadioButtonList1.SelectedIndex = 5 Then Image1.ImageUrl = "Images\sunflower.jpg" End If End Sub End Class

Output

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Que : 6 Create a user control that contains a list of colors. Add a button to the Web Form which when clicked changes the color of the Form to the color selected from the list. Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_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 id="body_page" runat="server" style="color: #000000"> <form id="form1" runat="server"> <div id="body_page1"> <asp:ListBox ID="ListBox1" runat="server" Height="83px" Style="z-index: 100; left: 212px; position: absolute; top: 71px" Width="125px" AutoPostBack="true" > <asp:ListItem>Red</asp:ListItem> <asp:ListItem>Pink</asp:ListItem> <asp:ListItem>Blue</asp:ListItem> <asp:ListItem>Orange</asp:ListItem> <asp:ListItem>Green</asp:ListItem>

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

<asp:ListItem>Yellow</asp:ListItem> <asp:ListItem>Lavender</asp:ListItem> </asp:ListBox> <br /> <strong><span style="font-size: 16pt">Select One Color and chage the background color of the form</span></strong></div> </form> </body> </html>

Default.aspx.vb
Partial Class _Default Inherits System.Web.UI.Page Protected Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged body_page.Attributes("bgcolor") = ListBox1.SelectedItem.Text End Sub End Class

Output

Que : 7 Create a new Web form which allows the client to enterstudent information such as name, email address, sex and telephone numer. The page also provides a submit button, which when clicked, will add this information to a TextBox which will also be displayed on the same page. Default.aspx

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_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> <asp:Label ID="Label1" runat="server" Style="z-index: 100; left: 10px; position: absolute; top: 23px" Text="Name"></asp:Label> <asp:Label ID="Label4" runat="server" Style="z-index: 101; left: 7px; position: absolute; top: 173px" Text="Phone number"></asp:Label> <asp:Label ID="Label2" runat="server" Style="z-index: 102; left: 10px; position: absolute; top: 59px" Text="Email id"></asp:Label> <asp:TextBox ID="TextBox2" runat="server" Style="z-index: 103; left: 112px; position: absolute; top: 57px"></asp:TextBox> <asp:TextBox ID="TextBox3" runat="server" Style="z-index: 104; left: 114px; position: absolute; top: 167px"></asp:TextBox> &nbsp; <asp:RadioButtonList ID="RadioButtonList1" runat="server" Height="50px" RepeatColumns="1" Style="z-index: 105; left: 114px; position: absolute; top: 95px" Width="155px"> <asp:ListItem>Man</asp:ListItem> <asp:ListItem>Woman</asp:ListItem> </asp:RadioButtonList> <asp:TextBox ID="TextBox1" runat="server" Style="z-index: 106; left: 112px; position: absolute; top: 21px"></asp:TextBox> <asp:Label ID="Label3" runat="server" Style="z-index: 107; left: 10px; position: absolute; top: 112px" Text="Sex"></asp:Label> <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox2" ErrorMessage="Enter valid Email id" Style="z-index: 108; left: 300px; position: absolute; top: 56px" ValidationExpression="\w+([-+.']\w+)*@\w+([.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator> &nbsp; <asp:Button ID="Button1" runat="server" Style="z-index: 109; left: 139px; position: absolute; top: 238px" Text="Button" /> <asp:TextBox ID="TextBox4" runat="server" BackColor="Khaki" BorderColor="Orange"

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

BorderStyle="Dotted" Columns="4" ForeColor="Black" Height="128px" Style="z-index: 110; left: 28px; position: absolute; top: 297px" TextMode="MultiLine" Width="254px"></asp:TextBox> &nbsp; <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="RadioButtonList1" ErrorMessage="Must be select gender" Style="z-index: 112; left: 297px; position: absolute; top: 112px"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox1" ErrorMessage="Must be enter the name" Style="z-index: 113; left: 293px; position: absolute; top: 21px"></asp:RequiredFieldValidator> </div> </form> </body> </html>

Default.aspx.vb
Partial Class _Default Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox4.Text = "Name : " & TextBox1.Text & Environment.NewLine TextBox4.Text += "Email ID : " & TextBox2.Text & vbCrLf TextBox4.Text += "Sex : " & RadioButtonList1.SelectedItem.Text & Constants.vbCrLf TextBox4.Text += "Phone Number : " & TextBox3.Text End Sub End Class

Output

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Que : 8 Create a product catalog facility for an online mobile store. The web page will display multiple mobile phone photos and their prices. When user clicks on any particular photo, he or she should be navigated to the page for that mobile. This page will contain all details and features of selected mobile phone.

Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_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"> <asp:ListBox ID="ListBox1" runat="server" CssClass="style.css" Font-Bold="True" Font-Italic="True" Font-Size="Large" AutoPostBack="True"> <asp:ListItem>Nokia673f</asp:ListItem> <asp:ListItem>Nokia678b</asp:ListItem> <asp:ListItem>Nokia6260</asp:ListItem> <asp:ListItem>Nokia7600</asp:ListItem> </asp:ListBox> <br /><br />

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

<asp:Image ID="Image1" runat="server" /><br /><br /> &nbsp;<asp:Button ID="Button1" runat="server" Text="Get Detail" /><br /><br /> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </div> </form> </body> </html>

Default.aspx.vb
Partial Class _Default Inherits System.Web.UI.Page Protected Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged If ListBox1.SelectedIndex = 0 Then Image1.ImageUrl = "673f_1.JPG" ElseIf ListBox1.SelectedIndex = 1 Then Image1.ImageUrl = "678b_1.jpg" ElseIf ListBox1.SelectedIndex = 2 Then Image1.ImageUrl = "img_med_6260.jpg"Else Image1.ImageUrl = "img_med_7600.jpg" End If End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click If ListBox1.SelectedIndex = 0 Then Label1.Text = "15000" ElseIf ListBox1.SelectedIndex = 1 Then Label1.Text = "17000" ElseIf ListBox1.SelectedIndex = 2 Then Label1.Text = "7000" Else Label1.Text = "6000" End If End Sub End Class

Output

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Que : 9 Develop an application which allow user to upload a .jpeg file and display it in an image box on the same page. Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_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> &nbsp; <asp:FileUpload ID="FileUpload1" runat="server" Height="25px" Style="z-index: 100; left: 18px; position: absolute; top: 17px" Width="235px" /> <asp:Image ID="Imagebox1" runat="server" Height="173px" Style="z-index: 101; left: 32px; position: absolute; top: 100px" Width="207px" BorderColor="OrangeRed" BorderStyle="Dashed"/> <asp:Button ID="Button1" runat="server" Style="z-index: 103; left: 285px; position: absolute; top: 17px" Text="Upload" /> </div> </form> </body> </html>

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Default.aspx.vb
Partial Class _Default Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim path As String path = Server.MapPath("~/") FileUpload1.SaveAs(path + FileUpload1.FileName) Imagebox1.ImageUrl = FileUpload1.PostedFile.FileName End Sub End Class

Output :

Unit : 3 Validation Controls ASP.NET Objects and Data Collection Class


Que:-1 Write a program that gets user input such as the user name, mode of payment, appropriate credit card. After

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

the user enters the appropriate values the Validation button validates the values entered. Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_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> <asp:Label ID="Label1" runat="server" Style="z-index: 100; left: 13px; position: absolute; top: 20px" Text="Name :"></asp:Label> <asp:Label ID="Label2" runat="server" Style="z-index: 101; left: 14px; position: absolute; top: 53px" Text="No of Qty"></asp:Label> <asp:Label ID="Label3" runat="server" Style="z-index: 102; left: 16px; position: absolute; top: 84px" Text="Payment by credit card"></asp:Label> <asp:TextBox ID="TextBox1" runat="server" Style="z-index: 103; left: 168px; position: absolute; top: 19px"></asp:TextBox> <asp:TextBox ID="TextBox3" runat="server" Style="z-index: 104; left: 169px; position: absolute; top: 82px"></asp:TextBox> <asp:TextBox ID="TextBox2" runat="server" Style="z-index: 105; left: 168px; position: absolute; top: 50px"></asp:TextBox> <asp:Button ID="Button1" runat="server" Style="z-index: 106; left: 169px; position: absolute; top: 132px" Text="Done" /> <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox3" ErrorMessage="Enter the valid credit card number" Style="zindex: 107; left: 340px; position: absolute; top: 86px" ValidationExpression="^[34][09]{9,15}$"></asp:RegularExpressionValidator> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox3" ErrorMessage="RequiredFieldValidator" Style="z-index: 109; left: 344px; position: absolute; top: 87px"></asp:RequiredFieldValidator> </div> </form> </body> </html>

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Output

Que : 2 Create a Form that receives the user name, address, date, nationality, country preferred for working and skill sets from the user. The country preferred data should appear in a dropdownlist whereas; others should be entered in a textbox. Validate all the controls. The Form is named formexp.aspx. The date should appear between 1/1/1900 and 1/1/2090. formexp.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="formexp.aspx.vb" Inherits="_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>

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

<asp:Label ID="Label1" runat="server" Style="z-index: 100; left: 184px; position: absolute; top: 89px" Text="Name"></asp:Label> <asp:Label ID="Label2" runat="server" Style="z-index: 101; left: 183px; position: absolute; top: 122px" Text="Address"></asp:Label> <asp:TextBox ID="TextBox1" runat="server" Style="z-index: 102; left: 330px; position: absolute; top: 92px" Width="222px"></asp:TextBox> <asp:TextBox ID="TextBox3" runat="server" Style="z-index: 103; left: 329px; position: absolute; top: 195px" Width="222px"></asp:TextBox> <asp:Label ID="Label3" runat="server" Style="z-index: 104; left: 185px; position: absolute; top: 197px" Text="DOB"></asp:Label> <asp:Label ID="Label4" runat="server" Style="z-index: 105; left: 186px; position: absolute; top: 234px" Text="Nationality"></asp:Label> <asp:Label ID="Label5" runat="server" Style="z-index: 106; left: 189px; position: absolute; top: 276px" Text="Country"></asp:Label> <asp:TextBox ID="TextBox2" runat="server" Height="53px" Style="z-index: 107; left: 329px; position: absolute; top: 126px" Width="222px"></asp:TextBox> &nbsp; <asp:TextBox ID="TextBox5" runat="server" Style="z-index: 108; left: 329px; position: absolute; top: 234px" Width="222px"></asp:TextBox> <asp:Button ID="Button1" runat="server" Style="z-index: 109; left: 298px; position: absolute; top: 329px" Text="Submit" /> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" ErrorMessage="Please enter name" Style="z-index: 110; left: 597px; position: absolute; top: 92px"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox2" ErrorMessage="Please enter address" Style="z-index: 111; left: 596px; position: absolute; top: 140px"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="TextBox3" ErrorMessage="Please enter DOB" Style="z-index: 112; left: 597px; position: absolute; top: 194px"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="TextBox5" ErrorMessage="Please enter Nationality" Style="z-index: 113; left: 595px; position: absolute; top: 241px"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="DropDownList1" ErrorMessage="Please enter Country" Style="z-index: 114; left: 595px; position: absolute;

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

top: 280px"></asp:RequiredFieldValidator> <asp:DropDownList ID="DropDownList1" runat="server" Style="zindex: 115; left: 329px; position: absolute; top: 277px" Width="226px"> <asp:ListItem>India</asp:ListItem> <asp:ListItem>China</asp:ListItem> <asp:ListItem>US</asp:ListItem> <asp:ListItem>UK</asp:ListItem> <asp:ListItem>Japan</asp:ListItem> </asp:DropDownList> <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox3" ErrorMessage="Enter date for proper format" Style="z-index: 116; left: 602px; position: absolute; top: 195px" ValidationExpression="^(19|20)\d\d[- /.](0[1-9]|1[012])[/.](0[1-9]|[12][0-9]|3[01])"></asp:RegularExpressionValidator> <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="TextBox3" ErrorMessage="Please enter date between 1-1-1900 to 1-1-2090" MaximumValue="01-01-2090" MinimumValue="01-01-1900" Style="z-index: 118; left: 780px; position: absolute; top: 186px"></asp:RangeValidator> </div> </form> </body> </html>

OUTPUT :

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Que : 3 Create a user control that receives the user name and password from the user and validates them. If the user name is ASP and the password is NET then the user is authorized, otherwise not.

Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_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> <asp:Label ID="Label1" runat="server" Style="z-index: 100; left: 171px; position: absolute; top: 144px" Text="User Name"></asp:Label> <asp:Label ID="Label2" runat="server" Style="z-index: 101; left: 173px; position: absolute; top: 196px" Text="Password"></asp:Label>

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

<asp:TextBox ID="TextBox1" runat="server" Style="z-index: 102; left: 335px; position: absolute; top: 143px"></asp:TextBox> <asp:TextBox ID="TextBox2" runat="server" Style="z-index: 103; left: 335px; position: absolute; top: 194px" TextMode="Password"></asp:TextBox> <asp:Button ID="Button1" runat="server" Style="z-index: 104; left: 270px; position: absolute; top: 272px" Text="Submit" /> <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" Style="z-index: 106; left: 258px; position: absolute; top: 233px" Text="Show Password" /> </div> </form> </body> </html>

Default.aspx.vb
Partial Class _Default Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click If TextBox1.Text = "ASP" And TextBox2.Text = "NET" Then MsgBox("Admin Login Successfully") Else MsgBox("User Login Successfully") End If End Sub Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged If CheckBox1.Checked Then TextBox2.TextMode = TextBoxMode.SingleLine Else TextBox2.TextMode = TextBoxMode.Password End If End Sub End Class

Output

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Que : 4 Accept ItemCode, ItemName, ItemPrice and Qty from the user, store it as cookies and then display them on the next page. Global.asax
<%@ Application Language="VB" %> <script runat="server"> Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs on application startup End Sub Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) Response.Cookies("itemcode").Expires = Now Response.Cookies("itemname").Expires = Now Response.Cookies("itemprice").Expires = Now Response.Cookies("itemqty").Expires = Now End Sub Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs when an unhandled error occurs End Sub Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs when a new session is started End Sub Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs when a session ends. ' Note: The Session_End event is raised only when the sessionstate mode

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

' is set to InProc in the Web.config file. If session mode is set to StateServer ' or SQLServer, the event is not raised. End Sub </script>

Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_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> <asp:Label ID="Label1" runat="server" Font-Bold="True" FontNames="Aharoni" Font-Size="XX-Large" Style="z-index: 100; left: 40px; position: absolute; top: 17px" Text="Invoice"></asp:Label> <asp:Label ID="Label2" runat="server" Style="z-index: 101; left: 16px; position: absolute; top: 71px" Text="Item Code"></asp:Label> <asp:Label ID="Label3" runat="server" Style="z-index: 102; left: 18px; position: absolute; top: 108px" Text="Item Name"></asp:Label> <asp:Label ID="Label4" runat="server" Style="z-index: 103; left: 19px; position: absolute; top: 143px" Text="Item Price"></asp:Label> <asp:Label ID="Label5" runat="server" Style="z-index: 104; left: 20px; position: absolute; top: 176px" Text="Item Quanty"></asp:Label> <asp:TextBox ID="TextBox1" runat="server" Style="z-index: 105; left: 105px; position: absolute; top: 70px"></asp:TextBox> <asp:TextBox ID="TextBox2" runat="server" Style="z-index: 106; left: 106px; position: absolute; top: 103px"></asp:TextBox> <asp:TextBox ID="TextBox3" runat="server" Style="z-index: 107; left: 107px; position: absolute; top: 139px"></asp:TextBox> <asp:TextBox ID="TextBox4" runat="server" Style="z-index: 108; left: 106px; position: absolute; top: 171px"></asp:TextBox> <asp:Button ID="Button1" runat="server" Style="z-index: 110; left: 94px; position: absolute; top: 225px" Text="Submit" /> </div> </form> </body> </html>

Default.aspx.vb

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Partial Class _Default Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Response.Cookies("itemcode1").Value = TextBox1.Text Response.Cookies("itemname1").Value = TextBox2.Text Response.Cookies("itemprice1").Value = TextBox3.Text Response.Cookies("itemqty1").Value = TextBox4.Text Response.Redirect("default2.aspx") End Sub End Class

Default2.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %> <!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="Label2" runat="server" Style="z-index: 100; left: 53px; position: absolute; top: 93px" Text="Item Name"></asp:Label> <asp:Label ID="Label1" runat="server" Style="z-index: 101; left: 54px; position: absolute; top: 58px" Text="Item Code"></asp:Label> <asp:Label ID="Label6" runat="server" Style="z-index: 102; left: 150px; position: absolute; top: 94px" Text="Item Code"></asp:Label> <asp:Label ID="Label7" runat="server" Style="z-index: 103; left: 149px; position: absolute; top: 136px" Text="Item Code"></asp:Label> <asp:Label ID="Label8" runat="server" Style="z-index: 104; left: 153px; position: absolute; top: 174px" Text="Item Code"></asp:Label> <asp:Label ID="Label3" runat="server" Style="z-index: 105; left: 52px; position: absolute; top: 132px" Text="Item Price"></asp:Label> <asp:Label ID="Label4" runat="server" Style="z-index: 106; left: 53px; position: absolute; top: 170px" Text="Item Quanty"></asp:Label> <asp:Label ID="Label5" runat="server" Style="z-index: 107; left: 198px; position: absolute; top: 56px" Text="Item Quanty"></asp:Label> <asp:Label ID="Label9" runat="server" BackColor="WhiteSmoke" BorderStyle="Dotted" Font-Names="Arial Black" Font-Size="X-Large" ForeColor="#00C0C0" Style="z-index: 109; left: 40px; position: absolute; top: 4px" Text="Display the Data"></asp:Label> </div>

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

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

Default2.aspx.vb
Partial Class Default2 Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'MsgBox(Request.Cookies("name").Value.ToString) Label5.Text = Request.Cookies("itemcode1").Value.ToString Label6.Text = Request.Cookies("itemname1").Value.ToString Label7.Text = Request.Cookies("itemprice1").Value.ToString Label8.Text = Request.Cookies("itemqty1").Value.ToString End Sub End Class

Output

Que : 7 Create a table StudentInfo, which contain rollno, name and year of a student. And also create a table StudentScore which contain marks of three subjects for each student. Display name of all the students in a DropDownList and according to users choice, particular student record should display in a FormView/DetailView control.

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_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"> <asp:DropDownList ID="DropDownList1" runat="server" style="zindex: 100; left: 256px; position: absolute; top: 120px" AutoPostBack="True" DataSourceID="SqlDataSource1" DataTextField="rollno" DataValueField="rollno" Width="203px"> </asp:DropDownList> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [rollno], [maths], [dbms], [dcn] FROM [stuscore]"></asp:SqlDataSource> &nbsp; <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataSourceID="SqlDataSource1" Height="50px" Style="z-index: 101; left: 304px; position: absolute; top: 264px" Width="128px" BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2"> <Fields> <asp:BoundField DataField="rollno" HeaderText="rollno" SortExpression="rollno" /> <asp:BoundField DataField="maths" HeaderText="maths" SortExpression="maths" /> <asp:BoundField DataField="dbms" HeaderText="dbms" SortExpression="dbms" /> <asp:BoundField DataField="dcn" HeaderText="dcn" SortExpression="dcn" /> </Fields> <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" /> <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" /> <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" /> <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" /> <EditRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" /> </asp:DetailsView> <asp:FormView ID="FormView1" runat="server" BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2" DataKeyNames="rollno" DataSourceID="SqlDataSource2" GridLines="Both" Style="z-index: 102;

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

left: 304px; position: absolute; top: 208px" Width="128px"> <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" /> <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" /> <EditItemTemplate> rollno: <asp:Label ID="rollnoLabel1" runat="server" Text='<%# Eval("rollno") %>'></asp:Label><br /> name: <asp:TextBox ID="nameTextBox" runat="server" Text='<%# Bind("name") %>'> </asp:TextBox><br /> age: <asp:TextBox ID="ageTextBox" runat="server" Text='<%# Bind("age") %>'> </asp:TextBox><br /> <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update"> </asp:LinkButton> <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"> </asp:LinkButton> </EditItemTemplate> <InsertItemTemplate> rollno: <asp:TextBox ID="rollnoTextBox" runat="server" Text='<%# Bind("rollno") %>'> </asp:TextBox><br /> name: <asp:TextBox ID="nameTextBox" runat="server" Text='<%# Bind("name") %>'> </asp:TextBox><br /> age: <asp:TextBox ID="ageTextBox" runat="server" Text='<%# Bind("age") %>'> </asp:TextBox><br /> <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert"> </asp:LinkButton> <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"> </asp:LinkButton> </InsertItemTemplate> <ItemTemplate> rollno: <asp:Label ID="rollnoLabel" runat="server" Text='<%# Eval("rollno") %>'></asp:Label><br /> name: <asp:Label ID="nameLabel" runat="server" Text='<%# Bind("name") %>'></asp:Label><br />

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

age: <asp:Label ID="ageLabel" runat="server" Text='<%# Bind("age") %>'></asp:Label><br /> &nbsp;&nbsp; </ItemTemplate> <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" /> <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" /> <EditRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" /> </asp:FormView> <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" DeleteCommand="DELETE FROM [stuinfo] WHERE [rollno] = @original_rollno AND [name] = @original_name AND (([age] = @original_age) OR ([age] IS NULL AND @original_age IS NULL))" InsertCommand="INSERT INTO [stuinfo] ([rollno], [name], [age]) VALUES (@rollno, @name, @age)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [rollno], [name], [age] FROM [stuinfo]" UpdateCommand="UPDATE [stuinfo] SET [name] = @name, [age] = @age WHERE [rollno] = @original_rollno AND [name] = @original_name AND (([age] = @original_age) OR ([age] IS NULL AND @original_age IS NULL))"> <DeleteParameters> <asp:Parameter Name="original_rollno" Type="Decimal" /> <asp:Parameter Name="original_name" Type="String" /> <asp:Parameter Name="original_age" Type="Decimal" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="name" Type="String" /> <asp:Parameter Name="age" Type="Decimal" /> <asp:Parameter Name="original_rollno" Type="Decimal" /> <asp:Parameter Name="original_name" Type="String" /> <asp:Parameter Name="original_age" Type="Decimal" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="rollno" Type="Decimal" /> <asp:Parameter Name="name" Type="String" /> <asp:Parameter Name="age" Type="Decimal" /> </InsertParameters> </asp:SqlDataSource> </form> </body> </html>

Default.aspx.vb
Imports System.Data.SqlClient Partial Class _Default Inherits System.Web.UI.Page Dim con As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Dhara\Documents\

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Visual Studio 2005\WebSites\ch3_7\App_Data\Database.mdf;Integrated Security=True;User Instance=True") Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged FormView1.PageIndex = DropDownList1.SelectedIndex DetailsView1.PageIndex = DropDownList1.SelectedIndex End Sub End Class

Output

Unit:-4 I/O and ADO.NET


Que : 1 Develop a web application to reserve online in a hotel. The user should enter date of arrival, number of days, room type, number of persons etc. He would be able to confirm booking and allowed to pay advance on confirmation. Default.aspx

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_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> <asp:Label ID="Label1" runat="server" BackColor="#E0E0E0" Font-Names="Aharoni" Font-Size="XX-Large"ForeColor="#00C0C0" Style="z-index: 100; left: 22px; position: absolute; top: 15px" Text="Online Hotel Booking"></asp:Label> <asp:Label ID="Label2" runat="server" Height="5px" Style="zindex: 101; left: 24px; position: absolute; top: 72px" Text="Enter Date"></asp:Label> &nbsp;&nbsp; <asp:TextBox ID="TextBox1" runat="server" Style="z-index: 102; left: 144px; position: absolute; top: 72px" Enabled="False"></asp:TextBox> <asp:Label ID="Label3" runat="server" Style="z-index: 103; left: 24px; position: absolute; top: 120px" Text="No of days"></asp:Label> <asp:Label ID="Label4" runat="server" Style="z-index: 104; left: 24px; position: absolute; top: 160px" Text="Room Type"></asp:Label> <asp:TextBox ID="TextBox2" runat="server" Style="z-index: 105; left: 144px; position: absolute; top: 120px"></asp:TextBox> <asp:DropDownList ID="DropDownList1" runat="server" Style="zindex: 106; left: 144px; position: absolute; top: 160px" Width="152px"> <asp:ListItem>Select Any One</asp:ListItem> <asp:ListItem>Single Bad</asp:ListItem> <asp:ListItem>Double Bad</asp:ListItem> </asp:DropDownList> <asp:Button ID="Button1" runat="server" Style="z-index: 107; left: 96px; position: absolute; top: 208px" Text="Conform Order" /> &nbsp; &nbsp; &nbsp; <asp:Calendar ID="Calendar1" runat="server" Style="z-index: 108; left: 296px; position: absolute; top: 72px" Visible="False"></asp:Calendar> <asp:Button ID="Button2" runat="server" Style="z-index: 109; left: 280px; position: absolute; top: 72px" Width="24px" Text=" " /> &nbsp;&nbsp; </div> </form> </body> </html>

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Default.aspx.vb
Partial 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 System.EventArgs) Handles Button1.Click Dim i As Integer i = MsgBox("Comform Your order??", MsgBoxStyle.YesNo) If i = 6 Then Response.Redirect("Default2.aspx") End If End Sub Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click Calendar1.Visible = True End Sub Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged Calendar1.Visible = False Dim a, b As Date a = Calendar1.SelectedDate b = Calendar1.TodaysDate If b <= a Then TextBox1.Text = Calendar1.SelectedDate Else MsgBox("select after " & Calendar1.TodaysDate) TextBox1.Text = "" End If End Sub End Class

Default2.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %> <!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> &nbsp; <asp:Label ID="Label1" runat="server" Style="z-index: 100; left: 64px; position: absolute; top: 40px" Text="Credit card No :"></asp:Label> <asp:Label ID="Label2" runat="server" Style="z-index: 101; left: 64px; position: absolute;

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

top: 80px" Text="CVV :"></asp:Label> top: 120px" Text="End Of Date"></asp:Label> <asp:TextBox ID="TextBox1" runat="server" Style="z-index: 103; left: 192px; position: absolute; top: 40px"></asp:TextBox> <asp:TextBox ID="TextBox2" runat="server" Style="z-index: 104; left: 192px; position: absolute; top: 80px"></asp:TextBox> <asp:TextBox ID="TextBox3" runat="server" Style="z-index: 105; left: 192px; position: absolute; top: 120px"></asp:TextBox> <asp:Button ID="Button1" runat="server" Style="z-index: 106; left: 128px; position: absolute; top: 176px" Text="Order Submit" /> </div> </form> </body> </html>

Default2.aspx.vb
Partial Class Default2 Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click MsgBox("Your order is Submited") End Sub End Class

Output

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Que : 2 Create an application to display all records from an Employee table with proper formatting. Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_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> <asp:FormView ID="FormView1" runat="server" AllowPaging="True" BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" DataKeyNames="eno" DataSourceID="SqlDataSource1" Font-Size="XX-Large" GridLines="Vertical" Style="z-index: 16; left: 280px; position: absolute; top: 119px" Width="434px"> <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

<RowStyle BackColor="#EEEEEE" ForeColor="Black" /> <EditItemTemplate> eno: <asp:Label ID="enoLabel1" runat="server" Text='<%# Eval("eno") %>'></asp:Label><br /> ename: <asp:TextBox ID="enameTextBox" runat="server" Text='<%# Bind("ename") %>'> </asp:TextBox><br /> designation: <asp:TextBox ID="designationTextBox" runat="server" Text='<%# Bind("designation") %>'> </asp:TextBox><br /> salary: <asp:TextBox ID="salaryTextBox" runat="server" Text='<%# Bind("salary") %>'> </asp:TextBox><br /> <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update"> </asp:LinkButton> <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"> </asp:LinkButton> </EditItemTemplate> <InsertItemTemplate> eno: <asp:TextBox ID="enoTextBox" runat="server" Text='<%# Bind("eno") %>'> </asp:TextBox><br /> ename: <asp:TextBox ID="enameTextBox" runat="server" Text='<%# Bind("ename") %>'> </asp:TextBox><br /> designation: <asp:TextBox ID="designationTextBox" runat="server" Text='<%# Bind("designation") %>'> </asp:TextBox><br /> salary: <asp:TextBox ID="salaryTextBox" runat="server" Text='<%# Bind("salary") %>'> </asp:TextBox><br /> <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert"> </asp:LinkButton> <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"> </asp:LinkButton> </InsertItemTemplate> <ItemTemplate>

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

eno: <asp:Label ID="enoLabel" runat="server" Text='<%# Eval("eno") %>'></asp:Label><br /> ename: <asp:Label ID="enameLabel" runat="server" Text='<%# Bind("ename") %>'></asp:Label><br /> designation: <asp:Label ID="designationLabel" runat="server" Text='<%# Bind("designation") %>'> </asp:Label><br /> salary: <asp:Label ID="salaryLabel" runat="server" Text='<%# Bind("salary") %>'></asp:Label><br /> <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit"> </asp:LinkButton> <asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete"> </asp:LinkButton> <asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New" Text="New"> </asp:LinkButton> </ItemTemplate> <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" /> <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" /> <EditRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" /> </asp:FormView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" DeleteCommand="DELETE FROM [emp] WHERE [eno] = @original_eno AND [ename] = @original_ename AND [designation] = @original_designation AND (([salary] = @original_salary) OR ([salary] IS NULL AND @original_salary IS NULL))" InsertCommand="INSERT INTO [emp] ([eno], [ename], [designation], [salary]) VALUES (@eno, @ename, @designation, @salary)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [eno], [ename], [designation], [salary] FROM [emp]" UpdateCommand="UPDATE [emp] SET [ename] = @ename, [designation] = @designation, [salary] = @salary WHERE [eno] = @original_eno AND [ename] = @original_ename AND [designation] = @original_designation AND (([salary] = @original_salary) OR ([salary] IS NULL AND @original_salary IS NULL))"> <DeleteParameters> <asp:Parameter Name="original_eno" Type="Decimal" /> <asp:Parameter Name="original_ename" Type="String" />

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

<asp:Parameter Name="original_designation" Type="String" /> <asp:Parameter Name="original_salary" Type="String" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="ename" Type="String" /> <asp:Parameter Name="designation" Type="String" /> <asp:Parameter Name="salary" Type="String" /> <asp:Parameter Name="original_eno" Type="Decimal" /> <asp:Parameter Name="original_ename" Type="String" /> <asp:Parameter Name="original_designation" Type="String" /> <asp:Parameter Name="original_salary" Type="String" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="eno" Type="Decimal" /> <asp:Parameter Name="ename" Type="String" /> <asp:Parameter Name="designation" Type="String" /> <asp:Parameter Name="salary" Type="String" /> </InsertParameters> </asp:SqlDataSource> </div> </form> </body> </html>

Default.aspx.vb
Imports System.Data.SqlClient Partial Class _Default Inherits System.Web.UI.Page Dim con As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Dhara\Documents\ Visual Studio 2005\WebSites\ch4_4\App_Data\emp1.mdf;Integrated Security=True;User Instance=True") Dim cmd As SqlCommand Dim i As Integer = 0 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim tc1 As New TableCell Dim tc2 As New TableCell Dim tc3 As New TableCell Dim tc4 As New TableCell Dim r As New TableRow con.Open() cmd = New SqlCommand("select * from emp", con) Dim dr As SqlDataReader cmd.ExecuteNonQuery() dr = cmd.ExecuteReader End Sub End Class

Output

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Que : 3 Write a simple Web application which reads off a table in an Access database file and display the data in a Web form. Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_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> &nbsp; <asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None" Style="z-index: 100; left: 77px; position: absolute; top: 74px"> <RowStyle BackColor="#EFF3FB" /> <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" /> <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" /> <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <EditRowStyle BackColor="#2461BF" /> <AlternatingRowStyle BackColor="White" /> </asp:GridView>

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

<asp:Label ID="Label1" runat="server" BackColor="HotTrack" Font-Bold="True" Font-Size="X-Large" ForeColor="Lavender" Style="z-index: 102; left: 82px; position: absolute; top: 26px" Text="Display Table data"></asp:Label> </div> </form> </body> </html>

Default.aspx.vb
Imports System.Data.OleDb Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Collage\sem 6\asp.net\ch4\ch4_5\EMP.mdb") Dim cmd As OleDbCommand con.Open() cmd = New OleDbCommand("select * from EMPLOYEE", con) Dim dr As OleDbDataReader dr = cmd.ExecuteReader GridView1.DataSource = dr GridView1.DataBind() con.Close() End Sub End Class

Output

Que : 4 Develop an application for online booking for a picture in a cinema hall. User should be able to select date,

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

time, picture and tickets. If the tickets are available user should be able to generate ticket. Global.asax
<%@ Application Language="VB" %> <script runat="server"> Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs on application startup Application("val") = 0 End Sub Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs on application shutdown End Sub Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs when an unhandled error occurs End Sub Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs when a new session is started Application("val") = Application("val") + 1 End Sub Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs when a session ends. ' Note: The Session_End event is raised only when the sessionstate mode ' is set to InProc in the Web.config file. If session mode is set to StateServer ' or SQLServer, the event is not raised. End Sub </script>

Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_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> <asp:Label ID="Label1" runat="server" Style="z-index: 100; left: 120px; position: absolute; top: 64px" Text="Name"></asp:Label> <asp:Label ID="Label2" runat="server" Style="z-index: 101; left: 120px; position: absolute; top: 104px" Text="Datetime"></asp:Label>

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

<asp:Label ID="Label3" runat="server" Style="z-index: 102; left: 120px; position: absolute; top: 144px" Text="Price"></asp:Label> &nbsp; <asp:TextBox ID="TextBox2" runat="server" Enabled="False" Style="z-index: 103; left: 272px; position: absolute; top: 104px"></asp:TextBox> <asp:TextBox ID="TextBox3" runat="server" Enabled="False" Style="z-index: 104; left: 272px; position: absolute; top: 144px"></asp:TextBox> <asp:TextBox ID="TextBox4" runat="server" Style="z-index: 105; left: 272px; position: absolute; top: 184px"></asp:TextBox> <asp:Label ID="Label4" runat="server" Style="z-index: 106; left: 120px; position: absolute; top: 184px" Text="Ticket"></asp:Label> <asp:Button ID="Button1" runat="server" Style="z-index: 107; left: 216px; position: absolute; top: 264px" Text="Submit" /> &nbsp; <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource1" DataTextField="name" DataValueField="name" Style="z-index: 108; left: 272px; position: absolute; top: 56px" Width="152px"> </asp:DropDownList> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" DeleteCommand="DELETE FROM [movie] WHERE [mid] = @original_mid AND [name] = @original_name AND [datetime] = @original_datetime AND [prize] = @original_prize" InsertCommand="INSERT INTO [movie] ([mid], [name], [datetime], [prize]) VALUES (@mid, @name, @datetime, @prize)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [mid], [name], [datetime], [prize] FROM [movie]" UpdateCommand="UPDATE [movie] SET [name] = @name, [datetime] = @datetime, [prize] = @prize WHERE [mid] = @original_mid AND [name] = @original_name AND [datetime] = @original_datetime AND [prize] = @original_prize"> <DeleteParameters> <asp:Parameter Name="original_mid" Type="Int32" /> <asp:Parameter Name="original_name" Type="String" /> <asp:Parameter DbType="Date" Name="original_datetime" /> <asp:Parameter Name="original_prize" Type="Decimal" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="name" Type="String" /> <asp:Parameter DbType="Date" Name="datetime" /> <asp:Parameter Name="prize" Type="Decimal" /> <asp:Parameter Name="original_mid" Type="Int32" /> <asp:Parameter Name="original_name" Type="String" />

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

<asp:Parameter DbType="Date" Name="original_datetime" /> <asp:Parameter Name="original_prize" Type="Decimal" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="mid" Type="Int32" /> <asp:Parameter Name="name" Type="String" /> <asp:Parameter DbType="Date" Name="datetime" /> <asp:Parameter Name="prize" Type="Decimal" /> </InsertParameters> </asp:SqlDataSource> <asp:Panel ID="Panel1" runat="server" Height="176px" Style="zindex: 110; left: 504px; position: absolute; top: 48px" Width="320px"> <asp:Label ID="Label5" runat="server" Style="z-index: 100; left: 40px; position: absolute; top: 24px" Text="Name"></asp:Label> <asp:Label ID="Label6" runat="server" Style="z-index: 101; left: 40px; position: absolute; top: 56px" Text="Datetime"></asp:Label> <asp:Label ID="Label7" runat="server" Style="z-index: 102; left: 40px; position: absolute; top: 88px" Text="Ticket"></asp:Label> <asp:Label ID="Label8" runat="server" Style="z-index: 103; left: 40px; position: absolute; top: 120px" Text="Price"></asp:Label> <asp:Label ID="Label9" runat="server" Style="z-index: 104; left: 112px; position: absolute; top: 24px" Text="Label"></asp:Label> <asp:Label ID="Label10" runat="server" Style="z-index: 105; left: 112px; position: absolute; top: 56px" Text="Label"></asp:Label> <asp:Label ID="Label11" runat="server" Style="z-index: 106; left: 112px; position: absolute; top: 88px" Text="Label"></asp:Label> <asp:Label ID="Label12" runat="server" Style="z-index: 108; left: 112px; position: absolute; top: 120px" Text="Label"></asp:Label> </asp:Panel> </div> </form> </body> </html>

Default.aspx.vb
Imports System.Data.SqlClient Partial Class _Default Inherits System.Web.UI.Page Dim con As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Dhara\Documents\ Visual Studio 2005\WebSites\ch4_7\App_Data\Database.mdf;Integrated Security=True;User Instance=True") Dim cmd As SqlCommand Dim i As Integer = 0

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click con.Open() cmd = New SqlCommand("insert into bill values(" & Application("val") & ",'" & DropDownList1.SelectedValue & "','" & TextBox2.Text & "','" & TextBox4.Text & "'," & CInt(TextBox4.Text) * CInt(TextBox3.Text) & ")", con) cmd.ExecuteNonQuery() Label9.Text = DropDownList1.SelectedValue Label10.Text = TextBox2.Text Label11.Text = TextBox3.Text Label12.Text = TextBox4.Text Panel1.Visible = True con.Close() End Sub Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged Panel1.Visible = False; con.Open() cmd = New SqlCommand("select * from movie where name='" & DropDownList1.SelectedValue & "'", con) cmd.ExecuteNonQuery() Dim dr As SqlDataReader dr = cmd.ExecuteReader While dr.Read TextBox2.Text = dr(2) TextBox3.Text = dr(3) End While con.Close() End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Panel1.Visible = False End Sub End Class

Output

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Que : 5 Create web page which will display details of file, selected by the user. Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_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> <asp:Label ID="Label1" runat="server" BackColor="LightCoral" BorderColor="Teal" BorderStyle="Solid" BorderWidth="2px" Font-Bold="True" Font-Names="Buxton Sketch" Font-Size="35px"

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Font-Underline="False" ForeColor="White" Style="z-index: 100; left: 28px; position: absolute; top: 24px" Text="Upload the File and show the detail of file"></asp:Label> <asp:Label ID="Label2" runat="server" BackColor="Green" FontSize="X-Large" ForeColor="LightSkyBlue" Style="z-index: 101; left: 37px; position: absolute; top: 105px" Text="File :"></asp:Label> <asp:FileUpload ID="FileUpload1" runat="server" BackColor="Silver" BorderColor="Navy" BorderStyle="Solid" Style="z-index: 102; left: 108px; position: absolute; top: 109px" Width="309px" /> <asp:Button ID="Button1" runat="server" BorderColor="Black" BorderStyle="Solid" Font-Size="15px" Style="z-index: 103; left: 346px; position: absolute; top: 150px" Text="Done" /> <asp:Panel ID="Panel1" runat="server" Height="123px" Style="zindex: 108; left: 27px; position: absolute; top: 214px" Width="269px"> <asp:Label ID="Label3" runat="server" Text="File name" style="left: 16px; position: absolute; top: 11px"></asp:Label> <asp:Label ID="Label4" runat="server" Text="File size" style="left: 19px; position: absolute; top: 44px"></asp:Label> <asp:Label ID="Label5" runat="server" Text="File extansion" style="left: 16px; position: absolute; top: 77px"></asp:Label> </asp:Panel> </div> </form> </body> </html> Default.aspx.vb Partial Class _Default Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Panel1.Visible = True Label3.Text = "File Name :" & FileUpload1.PostedFile.FileName Label4.Text = "File Length :" & FileUpload1.PostedFile.ContentLength / 1024 & "kb" Label5.Text = "File Type :" & FileUpload1.PostedFile.ContentType End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Panel1.Visible = False End Sub End Class

Output

ROLL NO 86

RATHOD AJAY A.

TYBCA NGCCA

Você também pode gostar