practical 1 - wordpress.com€¦ · practical 1 aim: write a program to change color of label text...

76
Dot Net Technology Enrollment No: 1 | Page Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. Design:

Upload: others

Post on 12-Apr-2020

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

1 | P a g e

Practical 1

AIM: Write a program to change color of Label text control programmatically in Asp .Net.

Design:

Page 2: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

2 | P a g e

Defaul.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" 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></title> </head> <body> <form id="form1" runat="server"> <div> <asp:Label ID="lblColor" runat="server" Font-Bold="True" Font-Size="XX-Large" Text="This Lable change color dynamically."></asp:Label> <br /> <asp:Button ID="btnRed" runat="server" Text="Red" Font-Bold="True" ForeColor="Red" onclick="btnRed_Click" Width="75px" /> <asp:Button ID="btnGreen" runat="server" Text="Green" Font-Bold="True" ForeColor="#009933" onclick="btnGreen_Click" Width="75px" /> <asp:Button ID="btnBlue" runat="server" Text="Blue" Font-Bold="True" ForeColor="Blue" onclick="btnBlue_Click" Width="75px" /> </div> </form> </body> </html>

Defaul.aspx.cs:

using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Drawing; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void btnRed_Click(object sender, EventArgs e) { lblColor.ForeColor = Color.Red; } protected void btnGreen_Click(object sender, EventArgs e) { lblColor.ForeColor = Color.Green; } protected void btnBlue_Click(object sender, EventArgs e) { lblColor.ForeColor = Color.Blue; } }

Page 3: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

3 | P a g e

Output: First Run

Page 4: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

4 | P a g e

Press on Red Button

Page 5: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

5 | P a g e

Press on Green Button

Page 6: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

6 | P a g e

Press on Blue Button

Page 7: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

7 | P a g e

Practical 2

AIM: Write a program to Enable-Disable Textbox and change width of TextBox

programmatically in Asp .Net

Design:

Page 8: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

8 | P a g e

Default.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" 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></title> </head> <body> <form id="form1" runat="server"> <div> <table> <tbody> <tr> <td> <asp:textbox runat="server" id="txtTest"> </asp:textbox></td> </tr> <tr> <td> <asp:button text="Enable" id="btnEnableTextBox" runat="server" onclick="btnEnableTextBox_Click" /> <asp:button text="Disable" id="btnDisableTextBox" runat="server" onclick="btnDisableTextBox_Click" /> </td> </tr> <tr> <td> <asp:button text="Change Width" id="btnChangeTextBoxWidth" onclick="btnChangeTextBoxWidth_Click" runat="server" /> </td> </tr> </tbody></table> </div> </form> </body> </html>

Page 9: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

9 | P a g e

Default.aspx.cs:

using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void btnEnableTextBox_Click(object sender, EventArgs e) { txtTest.Enabled = true; } protected void btnDisableTextBox_Click(object sender, EventArgs e) { txtTest.Enabled = false; } protected void btnChangeTextBoxWidth_Click(object sender, EventArgs e) { txtTest.Width = Convert.ToInt32(txtTest.Text); } }

Page 10: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

10 | P a g e

Output: Textbox Enable

Page 11: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

11 | P a g e

Textbox Disable

Page 12: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

12 | P a g e

Change Width:

Page 13: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

13 | P a g e

Practical 3

AIM: Develop ASP.Net Application through which user upload Image and that Image

should be displayed in Image Control.

Design:

Page 14: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

14 | P a g e

Default.aspx:

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> </asp:Content> <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <h2> Welcome to ASP.NET! </h2> <p> <asp:FileUpload ID="FileUpload1" runat="server" style="width: 217px" /> <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /> </p> <p> <asp:Image ID="Image1" runat="server" Height="100px" Width="100px" /> <asp:Label ID="Label1" runat="server" ForeColor="Red"></asp:Label> </p> </asp:Content>

Default.aspx.cs:

using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { if(FileUpload1.HasFile) { FileUpload1.SaveAs(Server.MapPath("~/Uploads/") + FileUpload1.FileName); Image1.ImageUrl = "~/Uploads/" + FileUpload1.FileName; } else { Label1.ForeColor = System.Drawing.Color.Red; Label1.Text = "File not Uploaded Sucessfully"; } } }

Page 15: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

15 | P a g e

Output: Upload File

Page 16: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

16 | P a g e

Display uploaded file in Image control

Page 17: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

17 | P a g e

Practical 4

AIM: Write a program to increase and decrease font size programmatically.

Design:

Page 18: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

18 | P a g e

Default.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" 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></title> </head> <body> <form id="form1" runat="server"> <div> <asp:Label ID="Label1" runat="server" Font-Size="10pt" Text="Government Engineering College Modasa"></asp:Label> <br /> </div> <asp:Button ID="btnIncrease" runat="server" onclick="btnIncrease_Click" Text="++" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:Button ID="btnDecrease" runat="server" onclick="btnDecrease_Click" Text="--" /> </form> </body> </html>

Page 19: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

19 | P a g e

Default.aspx.cs:

using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void btnIncrease_Click(object sender, EventArgs e) { //==== Get the current font size of the lable and remove pt concated with font size. int currentSize = Convert.ToInt32(Label1.Font.Size.ToString().Replace("pt", "")); //==== Increase font size by 1pt. Label1.Font.Size = currentSize + 1; } protected void btnDecrease_Click(object sender, EventArgs e) { //==== Get the current font size of the lable and remove pt concated with font size. int currentSize = Convert.ToInt32(Label1.Font.Size.ToString().Replace("pt", "")); //==== Decrease font size by 1pt. Label1.Font.Size = currentSize - 1; } }

Page 20: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

20 | P a g e

Output: Initial output before Increase and Decrease

Page 21: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

21 | P a g e

After 10 times Decrease

Page 22: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

22 | P a g e

After 5 times Decrease

Page 23: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

23 | P a g e

Practical 5

AIM: Develop ASP.Net code to rotate advertisements with AdRotator control.

Design:

AdRotatorDemo.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="AdRotatorDemo.aspx.cs" Inherits="AdRotatorDemo" %> <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server"> <asp:AdRotator ID="AdRotator1" runat="server" AdvertisementFile="~/adv.xml" /> </asp:Content>

Page 24: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

24 | P a g e

adv.xml File: <?xml version="1.0" encoding="utf-8" ?> <Advertisements> <Ad> <ImageUrl>rose1.jpg</ImageUrl> <NavigateUrl>http://www.1800flowers.com</NavigateUrl> <AlternateText> Order flowers, roses, gifts and more </AlternateText> <Impressions>20</Impressions> <Keyword>flowers</Keyword> </Ad> <Ad> <ImageUrl>rose2.jpg</ImageUrl> <NavigateUrl>http://www.babybouquets.com.au</NavigateUrl> <AlternateText>Order roses and flowers</AlternateText> <Impressions>20</Impressions> <Keyword>gifts</Keyword> </Ad> <Ad> <ImageUrl>rose3.jpg</ImageUrl> <NavigateUrl>http://www.flowers2moscow.com</NavigateUrl> <AlternateText>Send flowers to Russia</AlternateText> <Impressions>20</Impressions> <Keyword>russia</Keyword> </Ad> <Ad> <ImageUrl>rose4.jpg</ImageUrl> <NavigateUrl>http://www.edibleblooms.com</NavigateUrl> <AlternateText>Edible Blooms</AlternateText> <Impressions>20</Impressions> <Keyword>gifts</Keyword> </Ad> </Advertisements>

AdRotatorDemo.aspx.cs:

using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class AdRotatorDemo : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Page 25: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

25 | P a g e

Output: First Run

Page 26: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

26 | P a g e

Second Run

Page 27: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

27 | P a g e

Practical 6

AIM: Develop a ASP.Net application that will insert Registration details like

First Name, Last Name, City, State into database and display it into Gridview.

Design:

Page 28: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

28 | P a g e

Database:

Page 29: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

29 | P a g e

Page 30: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

30 | P a g e

Default.aspx:

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> </asp:Content> <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <h2> Welcome to ASP.NET! </h2> <p> First Name:<asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox> &nbsp;Last Name:<asp:TextBox ID="txtLastName" runat="server"></asp:TextBox> &nbsp;</p> <p> City:<asp:TextBox ID="txtCity" runat="server"></asp:TextBox> &nbsp;State:&nbsp;&nbsp; <asp:TextBox ID="txtState" runat="server"></asp:TextBox> </p> <p> <asp:Button ID="btnSubmit" runat="server" onclick="btnSubmit_Click" Text="Submit" /> </p> <p> <asp:Label ID="Label1" runat="server" ForeColor="#66FF66"></asp:Label> </p> <p> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"> <Columns> <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" /> <asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" /> <asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" /> <asp:BoundField DataField="City" HeaderText="City" SortExpression="City" /> <asp:BoundField DataField="State" HeaderText="State" SortExpression="State" /> </Columns> </asp:GridView> </p> <p> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT * FROM [Registration]"></asp:SqlDataSource> </p> <p> &nbsp;</p> <p> &nbsp;</p> </asp:Content>

Page 31: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

31 | P a g e

Default.aspx.cs:

using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.Sql; using System.Data.SqlClient; using System.Data; public partial class _Default : System.Web.UI.Page { SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=D:\2016_EVEN_Sem\SQLDatabase\App_Data\Database.mdf;Integrated Security=True;User Instance=True"); protected void Page_Load(object sender, EventArgs e) { } protected void btnSubmit_Click(object sender, EventArgs e) { con.Open(); SqlCommand cmd = new SqlCommand("insert into Registration values(@f1,@LastName,@City,@State)", con); cmd.Parameters.Add("@f1", txtFirstName.Text); cmd.Parameters.Add("@LastName", txtLastName.Text); cmd.Parameters.Add("@City", txtCity.Text); cmd.Parameters.Add("@State", txtState.Text); cmd.ExecuteNonQuery(); con.Close(); Label1.Text = "Data Inserted Successfully"; } }

Page 32: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

32 | P a g e

Output: Data Displayed in Gridview whatever in database.

Page 33: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

33 | P a g e

After Insert Data Operation

Page 34: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

34 | P a g e

Practical 7

AIM: Develop ASP.Net application of User Registration details and apply different kind of

Validations on it.

Design:

Required Field Validator:

Page 35: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

35 | P a g e

RegularExpression Validator:

Page 36: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

36 | P a g e

Range Validator:

Page 37: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

37 | P a g e

Compare Validator:

Page 38: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

38 | P a g e

Validation Summary:

Page 39: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

39 | P a g e

Default.aspx:

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> </asp:Content> <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <h2> Registration </h2> <p> Name: <asp:TextBox ID="txtName" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtName" ErrorMessage="Name is Required." ForeColor="Red"></asp:RequiredFieldValidator> </p> <p> Pincode: <asp:TextBox ID="txtPincode" runat="server"></asp:TextBox> <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtPincode" ErrorMessage="Pincode is not is valid formate." ForeColor="Red" ValidationExpression="\d{6}"></asp:RegularExpressionValidator> </p> <p> City: <asp:TextBox ID="txtCity" runat="server"></asp:TextBox> </p> <p> Email: <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox> <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtEmail" ErrorMessage="Email is not in valid formate." ForeColor="Red" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator> </p> <p> Age: <asp:TextBox ID="txtAge" runat="server"></asp:TextBox> <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txtAge" ErrorMessage="Age is between 18 to 31" ForeColor="Red" MaximumValue="31" MinimumValue="18"></asp:RangeValidator> </p> <p> Password: <asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox> </p>

Page 40: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

40 | P a g e

<p> Confirm Password: <asp:TextBox ID="txtConfirmPassword" runat="server" TextMode="Password"></asp:TextBox> <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="txtPassword" ControlToValidate="txtConfirmPassword" ErrorMessage="Passsword and Confirm Password should be same." ForeColor="Red"></asp:CompareValidator> </p> <p> <asp:Button ID="Button2" runat="server" Text="Save" onclick="Button2_Click" /> </p> <asp:ValidationSummary ID="ValidationSummary1" runat="server" ForeColor="Red" /> <p> &nbsp;</p> <p> &nbsp;</p> <p> &nbsp;</p> </asp:Content>

Default.aspx.cs:

using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button2_Click(object sender, EventArgs e) { } }

Output:

Page 41: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

41 | P a g e

Page 42: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

42 | P a g e

Practical 8

AIM: Develop ASP.Net application in which apply theme at page level and application

level.

Design:

Page 43: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

43 | P a g e

Add skin file in your website for theme:

ClientSide.skin:

<asp:TextBox runat="server" BackColor="#FF3399" Font-Bold="True" Font-Names="Verdana" ForeColor="White"></asp:TextBox> <asp:Label runat="server" Font-Bold="True" Font-Names="Verdana" ForeColor="#66FF66"></asp:Label>

Page Level Assigning a Theme:

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" Theme="ClientSide"%>

Application Level Assigning a Theme in Web.config:

<?xml version="1.0"?>

<configuration>

<system.web>

<pages theme="ClientSide"/>

</system.web>

</configuration>

Page 44: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

44 | P a g e

Default.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" Theme="ClientSide"%> <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server"> <h2> Welcome to ASP.NET! </h2> <p> <asp:Label ID="Label1" runat="server" Text="FirstName" Font-Bold="True"></asp:Label> &nbsp;: <asp:TextBox ID="txtFirstName" runat="server" ></asp:TextBox> </p> <p> <asp:Label ID="Label2" runat="server" Text="LastName"></asp:Label> : <asp:TextBox ID="txtLastName" runat="server"></asp:TextBox> </p> <p> <asp:Label ID="Label3" runat="server" Text="Email"></asp:Label> : <asp:TextBox ID="txtEmail" runat="server" EnableTheming="False"></asp:TextBox> </p> <p> <asp:Label ID="Label4" runat="server" Text="MobileNo"></asp:Label> : <asp:TextBox ID="txtMobileNo" runat="server" EnableTheming="True"></asp:TextBox> </p> </asp:Content>

Default.aspx.cs:

using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Page 45: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

45 | P a g e

Output:

Page 46: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

46 | P a g e

Practical 9

AIM: Develop ASP.Net application in which create Master page for courses and add web

pages for different kind of courses in it.

Design:

Page 47: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

47 | P a g e

MasterPage.Master

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <asp:ContentPlaceHolder id="head" runat="server"> </asp:ContentPlaceHolder> <style type="text/css"> .style1 { width: 100%; } </style> </head> <body> <form id="form1" runat="server"> <div> <table bgcolor="#33CCFF" class="style1"> <tr> <td colspan="2"> <asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="30pt" ForeColor="Red" Text="Master Page Demo"></asp:Label> </td> </tr> <tr> <td> <a href="CSharp.aspx">CSharp</a><br /> <a href="Advance%20Java.aspx">Advance Java</a><br /> <a href="Web%20Technology.aspx">Web Technology</a></td> <td> <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> </td> </tr> <tr> <td colspan="2"> <a href="mailto:Copyrigh@Masterpage">Copyrigh@Masterpage</a> 2016</td> </tr> </table> </div> </form> </body> </html>

Page 48: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

48 | P a g e

Add Master Page in Webform:

CSharp.aspx

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="CSharp.aspx.cs" Inherits="CSharp" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <p> <asp:Label ID="Label2" runat="server" Font-Bold="True" Font-Size="XX-Large" ForeColor="#003300" Text="C Sharp"></asp:Label> </p> <p> C sharp programming language is basically use to create dot net application.</p> <p> C sharp programming language is basically use to create dot net application.</p> <p> C sharp programming language is basically use to create dot net application.</p> <p> C sharp programming language is basically use to create dot net application.</p> </asp:Content>

Page 49: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

49 | P a g e

Page 50: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

50 | P a g e

Output:

Page 51: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

51 | P a g e

Practical 10

AIM: Write a program to check whether empty query string is entered in Asp .net.

Design:

Page 52: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

52 | P a g e

Page 53: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

53 | P a g e

QueryString1.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="QueryString1.aspx.cs" Inherits="QueryString1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Transter Data" /> </div> </form> </body> </html>

QueryString2.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="QueryString2.aspx.cs" Inherits="QueryString2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:Label ID="lblData" runat="server" Text=""></asp:Label> </div> </form> </body> </html>

Page 54: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

54 | P a g e

QueryString1.aspx.cs:

using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class QueryString1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { Response.Redirect("QueryString2.aspx?key="+TextBox1.Text); } }

QueryString2.aspx.cs: using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class QueryString2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["key"].ToString() == "") { lblData.Text = "Querystring is empty"; } else { lblData.Text = Request.QueryString["key"].ToString(); } } }

Page 55: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

55 | P a g e

Output:

Enter nothing in textbox and submit

Page 56: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

56 | P a g e

Enter some string in textbox and submit

Page 57: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

57 | P a g e

Practical 11

AIM: Write ASP.Net program that will use the Session.

Design:

Page 58: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

58 | P a g e

Web.config:

<?xml version="1.0"?> <configuration> <system.web> <compilation debug="false" targetFramework="4.0" /> <sessionState cookieless="false" mode="InProc" timeout="10"></sessionState> </system.web> </configuration>

Page 59: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

59 | P a g e

Session1.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Session1.aspx.cs" Inherits="Session1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> User Clicks: <asp:Label ID="lblClick" runat="server"></asp:Label> <br /> <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /> <br /> </div> </form> </body> </html>

Session2.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Session2.aspx.cs" Inherits="Session2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> User Clicks: <asp:Label ID="lblClick" runat="server"></asp:Label> <br /> <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /> </div> </form> </body> </html>

Page 60: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

60 | P a g e

Session1.aspx.cs:

using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Session1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["Clicks"] == null) { Session["Clicks"] = 1; } lblClick.Text = Session["Clicks"].ToString(); } else { Session["Clicks"] = Convert.ToInt32(Session["Clicks"]) + 1; lblClick.Text = Session["Clicks"].ToString(); } } }

Session2.aspx.cs: using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Session2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["Clicks"] == null) { Session["Clicks"] = 1; } lblClick.Text = Session["Clicks"].ToString(); } else { Session["Clicks"] = Convert.ToInt32(Session["Clicks"]) + 1; lblClick.Text = Session["Clicks"].ToString(); } } }

Page 61: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

61 | P a g e

Output:

Page 62: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

62 | P a g e

Practical 12

AIM: Write ASP.Net program that will use the Cookies.

Design:

Page 63: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

63 | P a g e

Page 64: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

64 | P a g e

Cookies1.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Cookies1.aspx.cs" Inherits="Cookies1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> UserName:<asp:TextBox ID="txtUserNaem" runat="server"></asp:TextBox> <br /> Passwrod:<asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox> <br /> <asp:Button ID="btnLogin" runat="server" Text="Login" onclick="btnLogin_Click" /> </div> </form> </body> </html>

CookiesAdminHome.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CookiesAdminHome.aspx.cs" Inherits="CookiesAdminHome" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> Welcome: <asp:Label ID="lblUserName" runat="server" Text=""></asp:Label> </div> </form> </body> </html>

Page 65: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

65 | P a g e

Cookies1.aspx.cs:

using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Cookies1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void btnLogin_Click(object sender, EventArgs e) { if (txtUserNaem.Text == "Admin" && txtPassword.Text == "abc") { Response.Cookies["UName"].Value = txtUserNaem.Text; Response.Cookies["UPass"].Value = txtPassword.Text; Response.Redirect("CookiesAdminHome.aspx"); } else { Response.Write("Invalid User Name and Password"); } } }

CookiesAdminHome.aspx.cs: using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class CookiesAdminHome : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["UName"] == null || Request.Cookies["UPass"]==null) { Response.Redirect("Cookies1.aspx"); } else { lblUserName.Text = Request.Cookies["UName"].Value; } } }

Page 66: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

66 | P a g e

Output:

Page 67: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

67 | P a g e

Practical 13

AIM: Create a web service to add, subtract, multiply and divide two numbers.

Design:

WebService.asmx:

<%@ WebService Language="C#" CodeBehind="~/App_Code/WebService.cs" Class="WebService" %>

WebService.asmx.cs:

using System; using System.Web; using System.Web.Services; /// <summary> /// Summary description for WebService /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. // [System.Web.Script.Services.ScriptService] public class WebService : System.Web.Services.WebService { public WebService () { //Uncomment the following line if using designed components //InitializeComponent(); }

Page 68: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

68 | P a g e

[WebMethod] public string HelloWorld() { return "Hello World"; } [WebMethod] public int add(int a, int b) { return a + b; } [WebMethod] public int sub(int a, int b) { return a - b; } [WebMethod] public int mul(int a, int b) { return a * b; } [WebMethod] public int div(int a, int b) { return a / b; } }

Page 69: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

69 | P a g e

Output:

Page 70: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

70 | P a g e

Page 71: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

71 | P a g e

Web Service Description Language:

Page 72: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

72 | P a g e

Design of Webform:

Page 73: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

73 | P a g e

Default.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" 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></title> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> <br /> <asp:Button ID="btnAdd" runat="server" Text="Add" onclick="btnAdd_Click" /> <asp:Button ID="btnSub" runat="server" Text="Sub" onclick="btnSub_Click" /> <asp:Button ID="btnMul" runat="server" Text="Mul" onclick="btnMul_Click" /> <asp:Button ID="btnDiv" runat="server" Text="Div" onclick="btnDiv_Click" /> <br /> <br /> Answer:<asp:Label ID="Label1" runat="server"></asp:Label> </div> </form> </body> </html>

Page 74: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

74 | P a g e

Default.aspx.cs:

using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { WebService ws = new WebService(); protected void Page_Load(object sender, EventArgs e) { } protected void btnAdd_Click(object sender, EventArgs e) { Label1.Text = Convert.ToString(ws.add(Convert.ToInt32(TextBox1.Text), Convert.ToInt32(TextBox2.Text))); } protected void btnSub_Click(object sender, EventArgs e) { Label1.Text = Convert.ToString(ws.sub(Convert.ToInt32(TextBox1.Text), Convert.ToInt32(TextBox2.Text))); } protected void btnMul_Click(object sender, EventArgs e) { Label1.Text = Convert.ToString(ws.mul(Convert.ToInt32(TextBox1.Text), Convert.ToInt32(TextBox2.Text))); } protected void btnDiv_Click(object sender, EventArgs e) { Label1.Text = Convert.ToString(ws.div(Convert.ToInt32(TextBox1.Text), Convert.ToInt32(TextBox2.Text))); } }

Page 75: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

75 | P a g e

Output: Addition

Subtraction

Page 76: Practical 1 - WordPress.com€¦ · Practical 1 AIM: Write a program to change color of Label text control programmatically in Asp .Net. ... Practical 6 AIM: Develop a ASP.Net application

Dot Net Technology Enrollment No:

76 | P a g e

Multiplication

Division