asp.net

47
Program 1: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace ASP.NETPROGRAMS { public partial class FirstPrgrm : System.Web.UI. Page { protected void Page_Load( object sender, EventArgs e) { } protected void btnclick_Click( object sender, EventArgs e) { lblmsg.Text = "Welcome to " + txtfirstname.Text + txtlastname.Text; }

Upload: nadikattu-ravikishore

Post on 17-Dec-2015

16 views

Category:

Documents


0 download

DESCRIPTION

asp.net

TRANSCRIPT

Program 1:

using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;

namespace ASP.NETPROGRAMS{ public partial class FirstPrgrm : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) {

}

protected void btnclick_Click(object sender, EventArgs e) { lblmsg.Text = "Welcome to " + txtfirstname.Text + txtlastname.Text; } }}

Program 2:

using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;

namespace ASP.NETPROGRAMS{ public partial class SecondPrgrm : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) {

} protected void btnadd_Click(object sender, EventArgs e) { int x = int.Parse(txtfirst.Text); int y = int.Parse(txtsecond.Text); int z = x + y; lblmsg.Text = "Addition result is:" + z; }

protected void btnsub_Click(object sender, EventArgs e) { int x = int.Parse(txtfirst.Text); int y = int.Parse(txtsecond.Text); int z = x - y; lblmsg.Text = "Subtraction result is:" + z; }

protected void btnmul_Click(object sender, EventArgs e) { int x = int.Parse(txtfirst.Text); int y = int.Parse(txtsecond.Text); int z = x * y; lblmsg.Text = "Multiplication result is:" + z; }

protected void btndiv_Click(object sender, EventArgs e) { int x = int.Parse(txtfirst.Text); int y = int.Parse(txtsecond.Text); int z = x / y; lblmsg.Text = "Division result is:" + z; } }}

Program 3:

using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;

namespace ASP.NETPROGRAMS{ public partial class ThirdPrgrm : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) {

}

protected void Button1_Click(object sender, EventArgs e) { int qty = int.Parse(txtqnty.Text); int cost = int.Parse(txtcost.Text); int total = qty * cost; lblmsg.Text = "Total bill is:" + total; } }}

Program 4:

using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;

namespace ASP.NETPROGRAMS{ public partial class FourthPrgrm : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) {

}

protected void Button1_Click(object sender, EventArgs e) { int m1 = int.Parse(txtm1.Text); int m2 = int.Parse(txtm2.Text); int m3 = int.Parse(txtm3.Text); int total = m1 + m2 + m3; int per = total / 3; lblmsg.Text = "Total is:" + total; lblper.Text = "Percentage is:" + per+"%"; } }}Program 5:

using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;

namespace ASP.NETPROGRAMS{ public partial class FifthPrgrm : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) {

}

protected void btncalculate_Click(object sender, EventArgs e) { int sal = int.Parse(txtsal.Text); double da = sal * 0.2; double hra = sal * 0.4; double totsal = sal + da + hra; txtda.Text = da.ToString(); txthra.Text = hra.ToString(); txttotsal.Text = totsal.ToString(); } }}

Program 6:

using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;

public partial class Program6 : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) {

} protected void btnsubmit_Click(object sender, EventArgs e) { if(txtuser.Text=="" && txtpassword.Text=="") { lblmsg.Text="UserName & Password must not be empty"; txtuser.Text = ""; txtuser.Focus(); } else if(txtuser.Text=="") { lblmsg.Text = "UserName Must not be Empty"; txtuser.Focus(); } else if(txtpassword.Text=="") { lblmsg.Text = "Password Must not be Empty"; txtpassword.Focus(); } else { if(txtuser.Text==txtpassword.Text) { lblmsg.Text = "Welcome to " + txtuser.Text; } else { lblmsg.Text = "Invalid User"; } txtuser.Text = ""; txtuser.Focus(); } }}

Program 7:

using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;

public partial class Program7 : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) {

} protected void btnregister_Click(object sender, EventArgs e) { if(txtuser.Text=="") { txtuser.Focus(); lbluser.Text = "UserName Must not be Empty"; } else if(txtpwrd.Text=="") { lbluser.Text = ""; lblpswrd.Text = "Password Must not be Empty"; } else if(txtpwrd.Text!=txtcnfrmpswrd.Text) { lbluser.Text = ""; lblpswrd.Text = ""; lblcnfrmpswrd.Text = ""; txtpwrd.Focus(); lblcnfrmpswrd.Text = "Password and confirm password must be same"; } else if (int.Parse(txtage.Text) b) { lblmsg.Text = "A is Greater Than B"; } else { lblmsg.Text = "A is not Greater Than B"; } } else if (drplst1.SelectedValue == "lessequal") { if (a = b) { lblmsg.Text = "A is Greater Than and equal B"; } else { lblmsg.Text = "A is not Greater Than or equal B"; } } else if (drplst1.SelectedValue == "notequal") { if (a != b) { lblmsg.Text = "A & B are not equal"; } else { lblmsg.Text = "A & B are equal"; } } else { if (a == b) { lblmsg.Text = "A & B are equal"; } } }}

Program 20:

using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;

public partial class Program20 : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) {

} protected void Button1_Click(object sender, EventArgs e) { int a=int.Parse(TextBox1.Text); if(a%2==0) { Label1.Text = "Given number is Even"; } else { Label1.Text = "Given number is Odd"; } }}

Program 21:

using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;

public partial class Program21 : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) {

} protected void Button1_Click(object sender, EventArgs e) { int a=int.Parse(TextBox1.Text); if(a>0) { Label1.Text = "Given number is Positive"; } else { Label1.Text = "Given number is Negative"; }

}}

Program 22:

using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;

public partial class Program22 : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) {

} protected void btnswap_Click(object sender, EventArgs e) { txt1.Text = txtb.Text; txt2.Text = txta.Text; }}

Program 23:

using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;

public partial class Program23 : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) {

} protected void btnsubmit_Click(object sender, EventArgs e) { int n = int.Parse(txtrev.Text); int rev = 0; int r = 0; for(int i=0;icurrent) { lblmsg.Text = "Current Balance is than the transaction balance"; txtnet.Text = netbal.ToString(); } else { netbal = current - trans; txtnet.Text = netbal.ToString(); } } else { netbal = current + trans; txtnet.Text = netbal.ToString(); } }}