AWP Prac

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

1.

/2a
 CS file------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication9
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click1(object sender, EventArgs e)
{
//font style
if (CheckBox1.Checked==true)
{
Label1.Font.Bold = true;
}
else
{
Label1.Font.Bold = false;
}

if (CheckBox2.Checked == true)
{
Label1.Font.Italic = true;
}
else
{
Label1.Font.Italic = false;
}

if (CheckBox3.Checked == true)
{
Label1.Font.Underline = true;
}
else
{
Label1.Font.Underline = false;
}

//font color

if (RadioButton1.Checked == true)
{
Label1.ForeColor = System.Drawing.Color.Red;
}
else if(RadioButton2.Checked == true)
{
Label1.ForeColor = System.Drawing.Color.Green;
}
else if(RadioButton3.Checked == true)
{
Label1.ForeColor = System.Drawing.Color.Blue;
}

//Font Family

Label1.Font.Name = DropDownList1.SelectedItem.Text;

//Font size
if(Int32.Parse(TextBox1.Text)>0)
{
Label1.Font.Size = FontUnit.Point(Int32.Parse(TextBox1.Text));
}
}
}
}
2. 1
CS file
using System;

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

protected void Button1_Click(object sender, EventArgs e)


{
TextBox1.Text = "you have selected: " + DropDownList1.SelectedItem.Value;
}
}
}

5.
6.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
public partial class WebForm2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}

protected void Button1_Click(object sender, EventArgs e)


{
}

protected void Button2_Click(object sender, EventArgs e)


{
Label1.Text = "";
Label2.Text = "";

Calendar1.SelectedDates.Clear();
}

protected void Calendar1_SelectionChanged(object sender, EventArgs e)


{
Label1.Text = "Your Selected Date:" +
Calendar1.SelectedDate.Date.ToShortDateString();
}

protected void Button3_Click(object sender, EventArgs e)


{
Label2.Text = DateTime.Now.ToLongTimeString();
}

}
}
7.
First select User form (add new)
Then drag to Aspx file
namespace WebApplication3
{
public partial class WebUserControl1 : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{

protected void Button1_Click(object sender, EventArgs e)


{
Label1.Text = "Your Name is " + TextBox1.Text + "You are living in" +
TextBox2.Text;
}
}
}

5.
Aspx

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DLLClassLibrary1
{
public class Class1
{
public string Factorial(string num)
{
int fact = 1;
int n1 = Convert.ToInt32(num);
for (int i = 1; i <= n1; i++)
{
fact = fact * i;
}
num = Convert.ToString(fact);
return num;
}
}
}

DLL
using DLLClassLibrary1;

namespace WebApplication5
{
public partial class WebForm1 : System.Web.UI.Page
{
Class1 c = new Class1();
protected void Page_Load(object sender, EventArgs e)
{
}

protected void Button1_Click(object sender, EventArgs e)


{
TextBox1.Text=c.Factorial(TextBox1.Text);
Label1.Text = "The Factorial of Given no is " + TextBox1.Text;
}
}
}

You might also like