Anda di halaman 1dari 6

DEPARTMENT OF SOFTWARE ENGINEERING STUDENT DEVELOPMENT PROGRAM

ASP.NET LAB MANUAL 1. ADDING TWO NUMBER PROCEDURE: No of labels : 3 No of textbox : 3 No of buttons : 1 CODING: 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 A, B, C As Integer A = TextBox1.Text B = TextBox2.Text C=A+B TextBox3.Text = C End Sub End Class OUTPUT:

A = TextBox1.Text B = TextBox2.Text If A > B Then TextBox3.Text = A Else TextBox3.Text = B End If End Sub Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load TextBox1.Focus() End Sub End Class OUTPUT:

3. FINDING EVEN OR ODD 2. BIGGEST OF TWO NUMBERS PROCEDURE: No of labels : 3 No of textbox : 3 No of buttons : 2 CODING: 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 A, B As Integer PROCEDURE: No of labels : 2 No of textbox : 2 No of buttons : 2 CODING: 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 N As Integer N = TextBox1.Text If N Mod 2 = 0 Then TextBox2.Text = N & " IS EVEN NUMBER " Else TextBox2.Text = N & " IS ODD NUMBER " End If End Sub

Page 1

DEPARTMENT OF SOFTWARE ENGINEERING STUDENT DEVELOPMENT PROGRAM


Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Text = "" TextBox2.Text = "" TextBox1.Focus() End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load TextBox1.Focus() End Sub End Class OUTPUT: D=A+""+B+""+C TextBox7.Text = "UR HOBBIES " & D End Sub End Class OUTPUT:

4. REGISTRATION FORM PROCEDURE: No of labels : 5 No of textbox : 7 No of radio button: 2 No of checkbox : 3 No of button : 1 No of dropdownlist : 1 CODING: 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 A, B, C, D TextBox3.Text = "UR NAME IS " & TextBox1.Text TextBox4.Text = "UR PASSWORD IS " & TextBox2.Text If RadioButton1.Checked = True Then TextBox5.Text = "UR GENDER IS " & RadioButton1.Text Else TextBox5.Text = "UR GENDER IS " & RadioButton2.Text End If TextBox6.Text = "UR CITY IS " & DropDownList1.SelectedItem.Text If CheckBox1.Checked = True Then A = CheckBox1.Text End If If CheckBox2.Checked = True Then B = CheckBox2.Text End If If CheckBox1.Checked = True Then C = CheckBox3.Text End If

5. FINDING SELECTED AND NUMBER OF ITEMS PROCEDURE: No of labels : 1 No of textbox : 3 No of linkbutton : 4 No of dropdownlist : 1 CODING: Partial Class _Default Inherits System.Web.UI.Page Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click Dim A A = TextBox1.Text DropDownList1.Items.Add(A) TextBox1.Text = "" TextBox1.Focus() End Sub Protected Sub LinkButton2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton2.Click Dim B B = DropDownList1.SelectedItem.Text TextBox2.Text = B End Sub Protected Sub LinkButton3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton3.Click Dim C C = DropDownList1.Items.Count TextBox3.Text = C End Sub Protected Sub LinkButton4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton4.Click DropDownList1.Items.Clear() End Sub End Class OUTPUT:

Page 2

DEPARTMENT OF SOFTWARE ENGINEERING STUDENT DEVELOPMENT PROGRAM


<%@ 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"> 6. USING DROPDOWNLIST PROCEDURE: No of labels : 2 No of linkbutton : 1 No of dropdownlist : 3 CODING: Partial Class _Default Inherits System.Web.UI.Page Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click Dim A, B, C A = DropDownList1.Text B = DropDownList2.Text C = DropDownList3.Text Label2.Text = A & "/" & B & "/" & C End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim I For I = 1 To 12 DropDownList1.Items.Add(I) Next I For I = 1 To 31 DropDownList2.Items.Add(I) Next I For I = 1980 To 2010 DropDownList3.Items.Add(I) Next I End Sub End Class OUTPUT: <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> <SCRIPT runat="server"> Sub one(ByVal suorce As Object, ByVal args As ServerValidateEventArgs) If Len(args.Value) > 6 Then args.IsValid = True Else args.IsValid = False End If End Sub </SCRIPT> </head> <body> <form id="form1" runat="server"> <div> <asp:Label ID="Label1" runat="server" Font-Size="XX-Large" Height="42px" Style="zindex: 100; left: 115px; position: absolute; top: 105px" Text="PASSWORD" Width="213px"></asp:Label> <asp:TextBox ID="TextBox1" runat="server" BorderColor="Black" BorderStyle="Solid" Font-Size="XX-Large" Style="z-index: 101; left: 380px; position: absolute; top: 105px" Width="314px" TextMode="Password"></asp:TextBox> <asp:CustomValidator ID="CustomValidator1" runat="server" controltovalidate="textbox1" ErrorMessage="min 6 chars" OnServerValidate=one Font-Size="XX-Large" Style="z-index: 104; left: 738px; position: absolute; top: 108px" Width="235px"></asp:CustomValidator> <asp:Button ID="Button1" runat="server" BorderColor="Black" BorderStyle="Outset" Font-Size="XX-Large" Style="z-index: 102; left: 447px; position: absolute; top: 260px" Text="CLICK" /> </div> </form> </body> </html> OUTPUT: 1

7. CUSTOM VALIDATOR PROCEDURE: No of labels : 1 No of textbox : 1 No of button : 1 No of customvalidator : CODING:

Page 3

DEPARTMENT OF SOFTWARE ENGINEERING STUDENT DEVELOPMENT PROGRAM


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1transitional.dtd"> <script runat ="Server" > Sub CHECK(ByVal SENDER As Object, ByVal E As EventArgs) If CHECK1.Checked Then WORK.Text = HOME.Text Else WORK.Text = "" End If End Sub</script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form runat="server"> <p> &nbsp; <asp:CheckBox ID="CHECK1" TEXT="SAME AS PHONE" TextAlign="RIGHT" AutoPostBack ="true" OnCheckedChanged ="CHECK" runat="SERVER" style="z-index: 102; left: 774px; position: absolute; top: 273px" FontSize="X-Large" Width="369px" /> </p> <p> &nbsp;</p> <p> &nbsp;</p> <p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="font-size: 24pt"> HOME PHONE: </span> <asp:TextBox ID="HOME" RUNAT="SERVER" style="z-index: 103; left: 446px; position: absolute; top: 148px" BorderColor="Black" BorderStyle="Solid" Font-Size="X-Large"/> <span style="font-size: 36pt"> <br /> </span> </p> <p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="font-size: 32pt">&nbsp;</span></p> <p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;

8. BUTTON PROCEDURE: No of button

CODING: <%@ 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"> <script runat ="server" > Sub submit(ByVal source As Object, ByVal e As EventArgs) Button1.Text = "YOU CLICKED ME!" End Sub </script> <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" text="CLICK ME" runat="server" onclick="submit" style="z-index: 100; left: 356px; position: absolute; top: 149px" FontNames="Arial Black" Font-Size="XX-Large" Width="486px" />&nbsp;</div> </form> </body> </html> OUTPUT:

9.CHECKBOX PROCEDURE: No of textbox No of checkbox

: :

2 1

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

Page 4

DEPARTMENT OF SOFTWARE ENGINEERING STUDENT DEVELOPMENT PROGRAM


&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="font-size: 32pt"><span style="font-size: 24pt"> WORK PHONE: </span></span> <asp:TextBox ID="WORK" runat="SERVER" style="z-index: 101; left: 442px; position: absolute; top: 273px" BorderColor="Black" BorderStyle="Solid" Font-Size="X-Large" /> <span style="font-size: 32pt">&nbsp;</span></p> <p> <span style="font-size: 32pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; </span> </p> <p> &nbsp;</p> <p> &nbsp;</p> </form> </body> </html> OUTPUT: LABEL1.Text = "YOU HAVE SELECTED " & RED.Text ElseIf GREEN.Checked Then LABEL1.Text = "YOU HAVE SELECTED " & GREEN.Text ElseIf BLUE.Checked Then LABEL1.Text = "YOU HAVE SELECTED " & BLUE.Text End If End Sub</script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form runat="server"> <span style="font-size: 24pt"><strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="font-size: 32pt"> SELECT YOUR FAVORITE COLOR: <br /> </span></strong></span> <asp:RadioButton ID="RED" Text="RED" Checked="TRUE" GroupName="COLORS" runat ="SERVER" style="z-index: 100; left: 323px; position: absolute; top: 147px" Font-Size="XXLarge" Width="128px" /> <br /> <asp:RadioButton ID="GREEN" Text="GREEN" Checked="TRUE" GroupName="COLORS" runat ="SERVER" style="z-index: 101; left: 542px; position: absolute; top: 148px" Font-Size="XXLarge" Width="150px" /> <br /> <asp:RadioButton ID="BLUE" Text="BLUE" Checked="TRUE" GroupName="COLORS" runat ="SERVER" style="z-index: 102; left: 831px; position: absolute; top: 149px" Font-Size="XXLarge" Width="159px" /> &nbsp; <p><asp:Label ID="LABEL1" runat ="SERVER" style="z-index: 103; left: 327px; position: absolute; top: 331px" Font-Size="XXLarge" Width="679px" /> <asp:Button Text="SUBMIT" OnClick="SUBMIT" runat ="server" style="z-index: 105; left: 531px; position: absolute; top: 243px" Font-Size="XXLarge" ID="Button1" Width="255px" /> </p> </form> </body> </html> OUTPUT:

10. RADIOPBUTTON PROCEDURE: No of labels : No of radiobutton : No of button :

1 3 1

CODING: <%@ 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"> <script runat ="SERVER"> Sub SUBMIT(ByVal SENDER As Object, ByVal E As EventArgs) If RED.Checked Then

Page 5

DEPARTMENT OF SOFTWARE ENGINEERING STUDENT DEVELOPMENT PROGRAM

11. ESTABLISHING A DATABASE CONECTIVITY PROCEDURE: Step 1: create a table in Microsoft access and copy. Step 2: create a new website. Step 3: go to solution explorer then paste the database that is copied under app_data. Step 4: place a gridview in the design page. Step 5: click the black triangle icon that is found on the right-top-end of the gridview. Step 6: in choose data source select <new data source> Next ->access database->ok->browse->app_data>database name select->ok->next->select * (or the cols and rows to be printed)->then finish. Step 7: run OUYPUT:

12. GENERATION OF CRYSTAL REPORT PROCEDURE: Step 1: create a new website. Step 2: create a database in access. Step 3: add a crystal report in the solution explorer. Step 4: place a crystal report viewer in the design page. Step 5: click the crystal report ->ok->create new connectionaccess/excel(dao)>click->select database name->finish->select table and press > ->next->next->-next->next->finish. Step 6: click the black triangle icon that is found on the right-top-end of the crystal report viewer. Step 7: choose report source <new report source ...> -> select the crystal report->ok. Step 8: run.

OUTPUT:

Page 6

Anda mungkin juga menyukai