Вы находитесь на странице: 1из 38

Program 1:

using
using
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Web;
System.Web.UI;
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
using
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Web;
System.Web.UI;
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
using
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Web;
System.Web.UI;
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
using
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Web;
System.Web.UI;
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
using
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Web;
System.Web.UI;
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
using
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Web;
System.Web.UI;
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
using
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Web;
System.Web.UI;
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) <= 18 && int.Parse(txtage.Text)
<= 25)
{
lbluser.Text = "";
lblpswrd.Text = "";
lblcnfrmpswrd.Text = "";
lblage.Text = "Age Must be between 18 to 25";
}
else if(txtpnum.MaxLength>=10)
{
lbluser.Text = "";
lblpswrd.Text = "";
lblcnfrmpswrd.Text = "";
lblage.Text = "";
lblpnum.Text = "Phone Number must not exceed 10
numbers";
}
else
{
lbluser.Text = "";
lblpswrd.Text = "";
lblcnfrmpswrd.Text = "";
lblage.Text = "";
lblpnum.Text = "";
lblmsg.Text = "Sucessfully Registered";
}
}

Program 8:

using
using
using
using
using
using

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

public partial class prgrm9 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnsubmit_Click(object sender, EventArgs e)
{
string chk = "";
for (int i = 0; i < CheckBoxList1.Items.Count;i++ )
{
if (CheckBoxList1.Items[i].Selected)
{
chk += "</br>"+CheckBoxList1.Items[i].Text;

}
lblmsg.Text = "Your qualification is:" +
RadioButtonList1.SelectedValue + " " + "and" + " " + "your
selected course is:" + chk;
}
RadioButtonList1.ClearSelection();
CheckBoxList1.ClearSelection();
}
}

Program 9:

using
using
using
using
using
using

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

public partial class Program09 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Focus();
}

protected void btnsubmit_Click(object sender, EventArgs e)


{
if (rbnmale.Checked)
{
lblmsg.Text = "Customer Name is" + " " + TextBox1.Text +
" " + "and gender is" + " " + rbnmale.Text;
rbnmale.Checked = false;
TextBox1.Text = "";
TextBox1.Focus();
}
else
{
lblmsg.Text = "Customer Name is" + " " + TextBox1.Text +
" " + "and gender is" + " " + rbnfemale.Text;
rbnfemale.Checked = false;
TextBox1.Text = "";
TextBox1.Focus();
}
}
}
Program 10:

using
using
using
using
using
using

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

public partial class Program10 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
txtcname.Focus();
}
protected void btnclickme_Click(object sender, EventArgs e)
{
lblmsg.Text = "";
if(rbnoroom.Checked)
{
lblmsg.Text = txtcname.Text + " " + "you selected
Ordinary Room with cost 1500/-";
}
if(chkac.Checked)
{
lblmsg.Text = txtcname.Text + " " + "you selected Deluxe
Room with cost 2000/-";
}
if(chkcomputer.Checked)
{
lblmsg.Text = txtcname.Text + " " + "you selected Deluxe
Room with cost 1800/-";
}
if (chkac.Checked && chkcomputer.Checked)
{
lblmsg.Text = txtcname.Text + " " + "you selected Deluxe
Room with cost 2300/-";
}
}
protected void rbnoroom_CheckedChanged(object sender,
EventArgs e)
{
lblaminities.Visible = false;
chkac.Visible = false;
chkcomputer.Visible = false;
chkac.Checked = false;
chkcomputer.Checked = false;

}
protected void rbndroom_CheckedChanged(object sender,
EventArgs e)
{
lblaminities.Visible = true;
chkac.Visible = true;
chkcomputer.Visible = true;
if (chkac.Checked == false && chkcomputer.Checked ==
false)
{
lblmsg.Text = "Please select Aminities";
}
}
}
Program11:

using
using
using
using
using
using

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

public partial class Program11 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Focus();
}

protected void DropDownList1_SelectedIndexChanged(object


sender, EventArgs e)
{
if(TextBox1.Text=="")
{
Label1.Text = "Please enter customer name";
}
else
Label1.Text = TextBox1.Text + " " + "your State is" + " " +
DropDownList1.SelectedValue;
TextBox1.Text = "";
}
}
Program 12:

using
using
using
using
using
using

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

public partial class Program12 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Focus();
}
protected void Button1_Click(object sender, EventArgs e)

{
if (TextBox1.Text == "")
{
Response.Write("Please enter BookName");
}
else
{
DropDownList1.Items.Add(TextBox1.Text);
TextBox1.Text = "";
TextBox1.Focus();
}
}
}
Program 13:

using
using
using
using
using
using

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

public partial class Program13 : System.Web.UI.Page


{
int total = 0;
protected void Page_Load(object sender, EventArgs e)
{
}

public void Calculate()


{
if (chkc.Checked)
{
total = 750;
}
if (chkdotnet.Checked)
{
total = total + 3000;
}
if (chkjava.Checked)
{
total = total + 3000;
}
if (chkmvc.Checked)
{
total = total + 700;
}
}
protected void btnsubmit_Click(object sender, EventArgs e)
{
for (int i = 0; i < RadioButtonList1.Items.Count; i++)
{
if (RadioButtonList1.Items[i].Selected)
{
switch(i)
{
case 0:
Calculate();
break;
case 1:
Calculate();
total = total + 50;
break;
case 2:
Calculate();
total = total + 100;

break;
}
}
txtresult.Text = total.ToString();
}
}
}
Program 14:

using
using
using
using
using
using

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

public partial class Program14 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
DropDownList1.Items.Add(txtfirst.Text + txtlast.Text);
}
}

Program 15:

using
using
using
using
using
using

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

public partial class Program15 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
DropDownList2.Items.Clear();
}
protected void DropDownList1_SelectedIndexChanged(object
sender, EventArgs e)
{
DropDownList2.Items.Add(DropDownList1.SelectedItem.ToString()
);
}
}

Program 16:

using
using
using
using
using
using

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

public partial class Program16 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
ListBox1.Items.Clear();
}
protected void DropDownList1_SelectedIndexChanged(object
sender, EventArgs e)
{
ListBox1.Items.Add(DropDownList1.SelectedItem.ToString());
}
}

Program 17:

using
using
using
using
using
using

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

public partial class Program17 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
lblmsg.Text = "Hello"+" "+TextBox1.Text+" "+"you date of
birth is"+" "+DropDownList1.SelectedItem.ToString() +
DropDownList2.SelectedItem.ToString() +
DropDownList3.SelectedItem.ToString();
}
}

Program 18:

using
using
using
using
using
using

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

public partial class Program18 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
}
}
protected void DropDownList1_SelectedIndexChanged(object
sender, EventArgs e)
{
lblmsg.Text = "Result is:";
int a = int.Parse(txt1.Text);
int b = int.Parse(txt2.Text);
switch (DropDownList1.SelectedValue)
{
case "+":
lblmsg.Text += (a + b).ToString();
break;
case "-":
lblmsg.Text += (a - b).ToString();
break;

case "*":
lblmsg.Text += (a * b).ToString();
break;
case "/":
lblmsg.Text += (a / b).ToString();
break;
case "%":
lblmsg.Text += (a % b).ToString();
break;
}
}
}
Program 19:

using
using
using
using
using
using

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

public partial class Program19 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void drplst1_SelectedIndexChanged(object sender,
EventArgs e)
{
int a = int.Parse(txt1.Text);

int b = int.Parse(txt2.Text);
if (drplst1.SelectedValue == "less")
{
if (a < b)
{
lblmsg.Text = "A is Less Than B";
}
else
{
lblmsg.Text = "A is not Less Than B";
}
}
else if (drplst1.SelectedValue == "greater")
{
if (a > 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 LessThan And equal B";
}
else
{
lblmsg.Text = "A is not LessThan or equal B";
}
}
else if (drplst1.SelectedValue == "greaterequal")
{
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
using
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Web;
System.Web.UI;
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
using
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Web;
System.Web.UI;
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
using
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Web;
System.Web.UI;
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
using
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Web;
System.Web.UI;
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;i<n;i++)
{
r = n % 10;
rev = r + rev * 10;
n = n / 10;
}
lblmsg.Text = rev.ToString();
}
}

Program 24:

using
using
using
using
using
using

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

public partial class Program24 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnsubmit_Click(object sender, EventArgs e)
{
lblmsg.Text = "";
if(txt1.Text==txt2.Text)
{
lbluser.Text = "UserName & Password must not be same";
}
else if(txt2.Text!=txt3.Text)
{
lbluser.Text = "";
lblpass.Text = "Password & Confirm Password must be
same";
}
else

{
lblpass.Text = "";
lbluser.Text = "";
lblmsg.Text = "Login Succuessed";
}
}
}
Program 25:

using
using
using
using
using
using

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

public partial class Program25 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btn1_Click(object sender, EventArgs e)
{
int a = int.Parse(txtage.Text);
if(a<18 || a>25)
{
lblmsg.Text = "Age Must be b/n 18 to 25";
}

else
{
lblmsg.Text = txtname.Text+ " "+"your age is"+"
"+txtage.Text;
}
}
}
Program 27:

using
using
using
using
using
using

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

public partial class Program27 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void rbnlist_SelectedIndexChanged(object sender,
EventArgs e)
{
int start;

int end ;
int units=0;
if(txtend.Text==" " || txtstart.Text=="")
{
lblmsg.Text = "Please enter starting and ending reading
numbers";
}
else
{
start = int.Parse(txtstart.Text);
end = int.Parse(txtend.Text);
units = start - end;
lblmsg.Text = " ";
txtunits.Text = units.ToString();
}
if(rbnlist.SelectedItem.Text=="Industry")
{
units=(units*5);
lbl.Text = "Total Bill is:" + " " + units;
}
else if (rbnlist.SelectedItem.Text=="Commercial")
{
units=(units*4);
lbl.Text = "Total Bill is:" + " " + units;
}
else
{
units = (units * 3);
lbl.Text = "Total Bill is:" + " " + units;
}
}
}

Program 28:

using
using
using
using
using
using

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

public partial class Program28 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btn1_Click(object sender, EventArgs e)
{
double basicsal = double.Parse(txtbasic.Text);
if(ddl1.SelectedItem.Text=="Manager")
{
basicsal = basicsal+basicsal * 0.2;
txtsal.Text = (basicsal).ToString();
}
else if(ddl1.SelectedItem.Text=="Analyst")
{
basicsal = basicsal + basicsal * 0.1;
txtsal.Text = (basicsal).ToString();
}
else

{
basicsal = basicsal + basicsal * 0.05;
txtsal.Text = (basicsal).ToString();
}
}
}
Program 29:

using
using
using
using
using
using

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

public partial class Program29 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btntotal_Click(object sender, EventArgs e)
{
int m1 = int.Parse(txtm1.Text);
int m2 = int.Parse(txtm2.Text);

int m3 = int.Parse(txtm3.Text);
int tot = m1 + m2 + m3;
double result = tot / 3;
txttotal.Text = tot.ToString();
}
protected void btnresult_Click(object sender, EventArgs e)
{
int m1 = int.Parse(txtm1.Text);
int m2 = int.Parse(txtm2.Text);
int m3 = int.Parse(txtm3.Text);
int tot = m1 + m2 + m3;
double result = tot / 3;
txtresult.Text = result.ToString();
}
}
Program 30:

using
using
using
using
using
using

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

public partial class Program30 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
lblmsg.Text = "";
double current = double.Parse(txtcurrentbal.Text);
double trans = double.Parse(txttrans.Text);
double netbal = 0;
if(RadioButton2.Checked)
{
if(trans>current)
{
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();
}
}
}

Вам также может понравиться