0% found this document useful (0 votes)
68 views80 pages

Subject: Advance Web Programing: 1) Aishwarya Waghmare (62) 2) Sandeep Singh (55) Subject Sir: Kiran More

The document discusses several programming assignments for an advanced web programming course. It includes code snippets for: 1) An application that takes integer input from the user and displays the product. 2) An application that takes student details like ID, name, course and DOB as input and displays the information. 3) Object oriented programming examples including calculating factorial values, currency conversion, solving quadratic equations and temperature conversion.

Uploaded by

Parag Waghmare
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views80 pages

Subject: Advance Web Programing: 1) Aishwarya Waghmare (62) 2) Sandeep Singh (55) Subject Sir: Kiran More

The document discusses several programming assignments for an advanced web programming course. It includes code snippets for: 1) An application that takes integer input from the user and displays the product. 2) An application that takes student details like ID, name, course and DOB as input and displays the information. 3) Object oriented programming examples including calculating factorial values, currency conversion, solving quadratic equations and temperature conversion.

Uploaded by

Parag Waghmare
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 80

Subject : Advance Web Programing

1) Aishwarya Waghmare (62)


2) Sandeep Singh (55)

Subject Sir : Kiran more

Practical no 1: Working with basic C# and ASP .NET

a. Create an application that obtains four int values from the user and displays the product.

Default.aspx

<!DOCTYPE html>

<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" Text="Enter a"></asp:Label>


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

<br />

<br />

<asp:Label ID="Label2" runat="server" Text="Enter b"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;

<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>

</div>

<br />

<br />

<asp:Label ID="Label3" runat="server" Text="Enter c"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>

<br />

<br />

<asp:Label ID="Label4" runat="server" Text="Enter d"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>

<p>

&nbsp;</p>

<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"


Text="Result" />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;

<asp:Button ID="Button2" runat="server" OnClick="Button2_Click"


Text="Reset" />

<br />

<asp:Label ID="Label5" runat="server" Text="Label"></asp:Label>

</form>

</body>

</html>

Default.aspx.cs

using System;

using System.Collections.Generic;

using System.Linq;

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)

{
int r;

r = Convert.ToInt32(TextBox1.Text) * Convert.ToInt32(TextBox2.Text) *
Convert.ToInt32(TextBox3.Text) * Convert.ToInt32(TextBox4.Text);

Label5.Text = "result" + r.ToString();

protected void Button2_Click(object sender, EventArgs e)

TextBox1.Text = "";

TextBox2.Text = "";

TextBox3.Text = "";

TextBox4.Text = "";

Label1.Text = "";

}
Default.aspx

<!DOCTYPE html>

<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" Text="Enter String"></asp:Label>

&nbsp;&nbsp;&nbsp;

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>


<br />

<br />

<br />

<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"


Text="Result" />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Button ID="Button2" runat="server" OnClick="Button2_Click"


Text="Reset" />

<br />

<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>

<br />

<asp:Label ID="Label3" runat="server" Text="Label"></asp:Label>

</div>

<asp:Label ID="Label4" runat="server" Text="Label"></asp:Label>

<br />

<asp:Label ID="Label5" runat="server" Text="Label"></asp:Label>

<br />

<asp:Label ID="Label6" runat="server" Text="Label"></asp:Label>

<br />

<asp:Label ID="Label7" runat="server" Text="Label"></asp:Label>

<br />

<asp:Label ID="Label8" runat="server" Text="Label"></asp:Label>

<br />

<asp:Label ID="Label9" runat="server" Text="Label"></asp:Label>


<br />

<asp:Label ID="Label10" runat="server" Text="Label"></asp:Label>

<br />

<asp:Label ID="Label11" runat="server" Text="Label"></asp:Label>

</form>

</body>

</html>

Default.aspx.cs

using System;

using System.Collections.Generic;

using System.Linq;

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)

{
string s = TextBox1.Text;

Label2.Text = "string length=" + s.Length;

Label3.Text = "substring" + s.Substring(4, 3);

Label4.Text = "upper string=" + s.ToUpper();

Label5.Text = "lower string=" + s.ToLower();

string rev = "";

for (int i = s.Length - 1; i >= 0; i--)

rev = rev + s[i];

Label6.Text = "reverse string=" + rev.ToString();

Label7.Text = "replace s by t instring" + s.Replace('s', 't');

Label8.Text = "insert u in string:" + s.Insert(3, "u");

Label9.Text = "string truncate" + s.Trim();

Label10.Text = "remove string" + s.Remove(4);

Label11.Text = "index of string:" + s.IndexOf('n');

protected void Button2_Click(object sender, EventArgs e)

Label2.Text = "";
Label3.Text = "";

Label4.Text = "";

Label5.Text = "";

Label6.Text = "";

Label7.Text = "";

Label8.Text = "";

Label9.Text = "";

Label10.Text = "";

Label11.Text = "";

TextBox1.Text = "";

}
c. Create an application that receives the (Student Id, Student Name, Course Name, Date of

Birth) information from a set of students. The application should also display the

information of all the students once the data entered.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace ConsoleApplication1

class Program

public struct Student

public string StudID;

public string StudName;

public string CourseName;

public string DOB;

static void Main(string[] args)

Student[] stud = new Student[2]; Console.WriteLine("Enter the Student


details:"); for (int i = 0; i < 2; i++)

Console.WriteLine(); Console.WriteLine("Enter Student ID:");


stud[i].StudID = Console.ReadLine(); Console.WriteLine("Enter Student Name:");
stud[i].StudName = Console.ReadLine();

Console.WriteLine("Enter Student Course Name:");


stud[i].CourseName = Console.ReadLine(); Console.WriteLine("Enter Student DOB:");
stud[i].DOB = Console.ReadLine();

Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Student


details:"); for (int i = 0; i < 2; i++)

Console.WriteLine(); Console.WriteLine("Student ID:{0}",


stud[i].StudID); Console.WriteLine("Student Name:{0}", stud[i].StudName);
Console.WriteLine("Student Course Name:{0}", stud[i].CourseName);
Console.WriteLine("Student DOB:{0}", stud[i].DOB);

Console.ReadKey();

}
2. Working with Object Oriented C# and ASP .NET

a. Create simple application to perform following operations

i. Finding factorial Value ii. Money Conversion

iii. Quadratic Equation iv. Temperature Conversion

i. Finding factorial Value

Default.aspx

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
<title></title>

</head>

<body>

<form id="form1" runat="server">

<div>

<div id="fibb">

<asp:Label ID="Label1" runat="server" Text="Enter Number"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Button runat="server" OnClick="Button1_Click" Text="fibbo series" />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp; &nbsp;

<asp:Label ID="Label7" runat="server" Text="Label"></asp:Label>

<br />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<br />

<br />

<asp:Label ID="Label2" runat="server" Text="Enter Number"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Button ID="Button2" runat="server" Text="prime no"


OnClick="Button2_Click" />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Label ID="Label8" runat="server" Text="Label"></asp:Label>

<br />

<br />

<asp:Label ID="Label3" runat="server" Text="Enter Number"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Button ID="Button3" runat="server" Text="reverse no"


OnClick="Button3_Click" />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Label ID="Label9" runat="server" Text="Label"></asp:Label>

<br />

&nbsp;

<br />

<asp:Label ID="Label4" runat="server" Text="Enter Number"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;

<asp:Button ID="Button4" runat="server" Text="Sum of digit"


OnClick="Button4_Click" />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Label ID="Label10" runat="server" Text="Label"></asp:Label>

<br />

<br />

<asp:Label ID="Label5" runat="server" Text="Enter Character"></asp:Label>


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp; &nbsp;

<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;

<asp:Button ID="Button5" runat="server" Text="vowel or not"


OnClick="Button5_Click" />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Label ID="Label11" runat="server" Text="Label"></asp:Label>

<br />

<br />

&nbsp;

</div>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<br />

<asp:Label ID="Label13" runat="server" Text="Label"></asp:Label>

</div>

</form>

</body>

</html>

Default.aspx.cs

using System;

using System.Collections.Generic;

using System.Linq;

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)

int a, b, c, i, n;

a = 0;

b = 1;

Label7.Text = a.ToString() + b.ToString();

n = Convert.ToInt32(TextBox1.Text);

for (i = 1; i <= n; i++)

c = a + b;

Label7.Text = Label7.Text + c.ToString();

a = b;

b = c;

}
protected void Button2_Click(object sender, EventArgs e)

int i, c = 0, j, num;

num = Convert.ToInt32(TextBox2.Text);

for (j = 1; j <= num; j++)

i = num % j;

if (i == 0)

c = c + 1;

if (c == 2)

Label8.Text = "the given no is prime";

else

Label8.Text = "the given no is not prime";

protected void Button3_Click(object sender, EventArgs e)

long num, i, sum = 0;


num = Convert.ToInt32(TextBox3.Text);

while (num > 0)

i = num % 10;

sum = i + sum * 10;

num = num / 10;

Label9.Text = sum.ToString();

protected void Button4_Click(object sender, EventArgs e)

long num, i, sum = 0;

num = Convert.ToInt32(TextBox4.Text);

while (num > 0)

i = num % 10;

sum = i + sum;

num = num / 10;

Label10.Text = sum.ToString();

protected void Button5_Click(object sender, EventArgs e)

char c = Convert.ToChar(TextBox5.Text);
switch (c)

case 'a':

Label11.Text = "a is vowel";

break;

case 'e':

Label11.Text = "a is vowel";

break;

case 'i':

Label11.Text = "a is vowel";

break;

case 'o':

Label11.Text = "a is vowel";

break;

case 'u':

Label11.Text = "a is vowel";

break;

default:

Label11.Text = "it is not vowel";

break;

}
2. Working with Object Oriented C# and ASP .NET

a. Create simple application to perform following operations

i. Finding factorial Value ii. Money Conversion

iii. Quadratic Equation iv. Temperature Conversion

using System;

using System.Collections.Generic;

using System.Linq;

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)

int i, number, fact;

number = Convert.ToInt32(TextBox1.Text);

fact = number;

for (i = number - 1; i >= 1; i--)

fact = fact * i;

Label2.Text = "factorial of a no is " + fact;

}
ii money conversion

Default.aspx

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<div>

&nbsp;&nbsp;&nbsp;&nbsp;

<br />

<asp:Label ID="Label1" runat="server" Text="Enter amount in


rs"></asp:Label>

&nbsp;

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>


<br />

<br />

&nbsp;&nbsp;

<asp:Button ID="Button1" runat="server" OnClick="Button1_Click1" Text="US


DOLLAR" />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;

<asp:Label ID="Label6" runat="server" Text="Label"></asp:Label>

<br />

<br />

<br />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Button ID="Button2" runat="server" OnClick="Button2_Click"


Text="Euros" />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Label ID="Label7" runat="server" Text="Label"></asp:Label>

<br />

<br />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp; &nbsp;&nbsp;&nbsp;

<asp:Button ID="Button3" runat="server" OnClick="Button3_Click"


Text="British pounds" />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Label ID="Label8" runat="server" Text="Label"></asp:Label>

<br />

<br />

<br />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp; &nbsp;

<asp:Button ID="Button4" runat="server" OnClick="Button4_Click" Text="jap


yen" />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Label ID="Label9" runat="server" Text="Label"></asp:Label>

<br />

</div>

</form>

</body>

</html>

Default.aspx.cs

using System;

using System.Collections.Generic;

using System.Linq;

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_Click1(object sender, EventArgs e)

curConv s = new curConv();

double r = Convert.ToDouble(TextBox1.Text);

double rate = s.dolr(r);

Label6.Text = rate.ToString();

protected void Button2_Click(object sender, EventArgs e)

curConv s = new curConv();

double r = Convert.ToDouble(TextBox1.Text);

double rate = s.Erous(r);

Label7.Text = rate.ToString();

protected void Button3_Click(object sender, EventArgs e)

curConv s = new curConv();

double r = Convert.ToDouble(TextBox1.Text);

double rate = s.pounds(r);

Label8.Text = rate.ToString();

protected void Button4_Click(object sender, EventArgs e)

{
curConv s = new curConv();

double r = Convert.ToDouble(TextBox1.Text);

double rate = s.yen(r);

Label9.Text = rate.ToString();

public class curConv

public double dolr(double r)

r = r * 0.015;

return r;

public double Erous(double r)

r = r * 0.012;

return r;

public double pounds(double r)

r = r * 0.0011;

return r;

public double yen(double r)

r = r * 1.64;
return r;

Default.aspx

<!DOCTYPE html>

<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" Text="Enter Value of


celsius"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"


Text="Button" />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Label ID="Label3" runat="server" Text="Label"></asp:Label>

<br />

<br />

<asp:Label ID="Label2" runat="server" Text="Enter Value of


fahrenheit"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;

<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Button ID="Button2" runat="server" OnClick="Button2_Click"


Text="Button" />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Label ID="Label4" runat="server" Text="Label"></asp:Label>


</div>

</form>

</body>

</html>

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

public class tempconv

public double ctof(double temp)

temp = 9 / 5 * temp + 32;

return temp;

public double ftoc(double temp)

temp = (temp - 32) * 5 / 9;

return temp;

}
public partial class _Default : System.Web.UI.Page

protected void Page_Load(object sender, EventArgs e)

protected void Button1_Click(object sender, EventArgs e)

tempconv s = new tempconv();

double n = Convert.ToDouble(TextBox1.Text);

double x = s.ctof(n);

Label3.Text = x.ToString();

protected void Button2_Click(object sender, EventArgs e)

tempconv s = new tempconv();

double n = Convert.ToDouble(TextBox2.Text);

double x = s.ftoc(n);

Label4.Text = x.ToString();

}
Default.aspx

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<div>

<asp:Label ID="Label4" runat="server" Text="Function


overloading"></asp:Label>

<br />

<br />

<br />

<br />

<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>


<br />

</div>

<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>

<br />

<asp:Label ID="Label3" runat="server" Text="Label"></asp:Label>

</form>

</body>

</html>

Default.aspx.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

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

public int add(int a)

return a + a;

public int add(int a, int b)

{
return a + b;

public int add(int a, int b, int c)

return a + b + c;

protected void Page_Load(object sender, EventArgs e)

int x, y, z;

x = add(2);

y = add(2, 3);

z = add(2, 3, 4);

Label1.Text = x.ToString();

Label2.Text = y.ToString();

Label3.Text = z.ToString();

}
singleinheritance.aspx

<!DOCTYPE html>

<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" Text="Enter Number"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"


Text="Result" />

<br />
<br />

<br />

&nbsp;&nbsp;&nbsp;

<asp:Label ID="Label2" runat="server" Text="Square of a no:"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Label ID="Label3" runat="server" Text="Label"></asp:Label>

<br />

<br />

<br />

<asp:Label ID="Label4" runat="server" Text="cube of a no:"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Label ID="Label5" runat="server" Text="Label"></asp:Label>

</div>

</form>

<p>

&nbsp;&nbsp;&nbsp;

</p>

</body>

</html>

singleinheritance.aspx.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;
using System.Web.UI.WebControls;

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

protected void Page_Load(object sender, EventArgs e)

protected void Button1_Click(object sender, EventArgs e)

B s = new B();

int n = Convert.ToInt32(TextBox1.Text);

int x = s.sqr(n);

int y = s.cub(n);

Label3.Text = x.ToString();

Label5.Text = y.ToString();

public class A

public int sqr(int val1)

return val1 * val1;

}
}

public class B : A

public int cub(int val1)

return val1*val1*val1;

multilevel.aspx

<!DOCTYPE html>

<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" Text="Enter Number"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"


Text="Result" />

<br />

<asp:Label ID="Label2" runat="server" Text="No is power of 2"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Label ID="Label5" runat="server" Text="Label"></asp:Label>

<br />

<br />

<asp:Label ID="Label3" runat="server" Text="No is power of 3"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;

<asp:Label ID="Label6" runat="server" Text="Label"></asp:Label>

<br />

<br />

<asp:Label ID="Label4" runat="server" Text="No is power of 4"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Label ID="Label7" runat="server" Text="Label"></asp:Label>

</div>
</form>

</body>

</html>

multilevel.aspx.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

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

protected void Page_Load(object sender, EventArgs e)

protected void Button1_Click(object sender, EventArgs e)

C s = new C();

int n = Convert.ToInt32(TextBox1.Text);

int x = s.pow2(n);

int y = s.pow3(n);

int z = s.pow4(n);

Label5.Text = x.ToString();
Label6.Text = y.ToString();

Label7.Text = z.ToString();

public class A

public int pow2(int val1)

return val1 * val1;

public class B : A

public int pow3(int val1)

return val1 * val1 * val1;

public class C:B

public int pow4(int val1)

return val1 * val1 * val1 * val1;


}

Hierarchical.aspx

<!DOCTYPE html>

<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" Text="Enter a:"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

<br />

<br />

<asp:Label ID="Label2" runat="server" Text="Enter b"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>

<br />

<br />

<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"


Text="Result" />

<br />

<br />

<asp:Label ID="Label3" runat="server" Text="Label"></asp:Label>

<br />

<asp:Label ID="Label4" runat="server" Text="Label"></asp:Label>

</div>

</form>

</body>

</html>

Hierarchical.aspx.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;
using System.Web.UI.WebControls;

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

protected void Page_Load(object sender, EventArgs e)

protected void Button1_Click(object sender, EventArgs e)

B s1 = new B();

C s2 = new C();

int m = Convert.ToInt32(TextBox1.Text);

int n= Convert.ToInt32(TextBox2.Text);

int x = s1.add(m, n);

int y = s2.sub(m, n);

Label3.Text = x.ToString();

Label4.Text = y.ToString();

public class A

public int a;

public int b;

}
public class B : A

public int add(int val1, int val2)

a = val1;

b = val2;

return a + b;

public class C : A

public int sub(int val1, int val2)

a = val1;

b = val2;

return a - b;

}
iii)constructor overloading

<!DOCTYPE html>

<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" Text="Constructor


overloading:"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;

<br />

&nbsp;&nbsp;&nbsp;

<br />
&nbsp;&nbsp;&nbsp;

<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>

<br />

&nbsp;&nbsp;&nbsp;

<asp:Label ID="Label3" runat="server" Text="Label"></asp:Label>

<br />

&nbsp;&nbsp;&nbsp;

<asp:Label ID="Label4" runat="server" Text="Label"></asp:Label>

</div>

</form>

</body>

</html>

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

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

protected void Page_Load(object sender, EventArgs e)

add obj1 = new add(2);

add obj2 = new add(2, 3);


add obj3 = new add(2, 3, 4);

Label2.Text = obj1.r.ToString();

Label3.Text = obj2.r.ToString();

Label4.Text = obj3.r.ToString();

public class add

public int r;

public add(int a)

r = a + a;

public add(int a, int b)

r = a + b;

public add(int a, int b, int c)

r = a + b + c;

}
intfc.aspx

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<div>

<h1>Interface:</h1>

<br />

Enter String:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:TextBox ID="txt1" runat="server"></asp:TextBox>

<br />

<br />

<asp:Button ID="btn1" runat="server" onclick="btn1_Click" Text="Submit" />

<br />

<br />
<br />

<asp:Label ID="lbl1" runat="server"></asp:Label>

<br />

<br />

<asp:Label ID="lbl2" runat="server"></asp:Label>

</div>

</form>

</body>

</html>

intfc.aspx.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

public interface i1

void show_i1();

public interface i2

void show_i2();

}
public partial class intfc : System.Web.UI.Page,i1,i2

protected void Page_Load(object sender, EventArgs e)

protected void btn1_Click(object sender, EventArgs e)

show_i1();

show_i2();

public void show_i1()

lbl1.Text = "interface 1 called<br>" + txt1.Text;

public void show_i2()

lbl2.Text = "interface 2 called<br>" + txt1.Text;

}
Delegate

demo_delegate.aspx

<!DOCTYPE html>

<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" Text="Label"></asp:Label>


</div>

<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>

</form>

</body>

</html>

demo_delegate.aspx.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

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

public delegate string dele();

public static string display1()

string s1 = "sandeep";

return s1;

public static string display2()

string s2 = "sandeep singh";

return s2;

}
protected void Page_Load(object sender, EventArgs e)

dele d1 = new dele(display1);

d1();

dele d2 = new dele(display2);

d2();

Label1.Text = d1();

Label2.Text = d2();

Practical 3(b).Demonstrate the use of Calendar control to perform following

operations.

a) Display messages in a calendar control b) Display vacation in a calendar

control
c) Selected day in a calendar control using style d) Difference between two calendar

dates

3.a).

Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"


Inherits="_Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<div>

<asp:Label ID="lbl_fn" Text="First name" runat="server" style="color:


#000066"></asp:Label>

:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:TextBox
runat="server"

ID="txt_fn" AutoPostBack="True"/>

<br /><br />

<asp:Label ID="lbl_ln" Text="Last name" runat="server"></asp:Label>


:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:TextBox
runat="server"

ID="txt_ln" AutoPostBack="True"/>

<br /><br />

<asp:Label Text="Address" ID="lbl_add" runat="server" />:-


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:TextBox ID="txt_add" runat="server" TextMode="MultiLine"


AutoPostBack="True" />

<br /><br />

<asp:Label Text="Gender" ID="lbl_g" runat="server" />:-


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:RadioButton Text="Male" ID="r_male" runat="server"


GroupName="Gender"/>

<asp:RadioButton Text="Female" ID="r_female" runat="server"


GroupName="Gender" />

<br /><br />

<asp:Label ID="lbl_fav" Text="faviourate color" runat="server" />

:-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:DropDownList

Id="dropdownlist1" runat="server" AutoPostBack="True">

<asp:ListItem>red</asp:ListItem>

<asp:ListItem>blue</asp:ListItem>

<asp:ListItem>green</asp:ListItem>

<asp:ListItem>black</asp:ListItem>

</asp:DropDownList><br /><br />


<asp:Label ID="lbl_sub" Text="Select fav sub:" runat="server" />

<asp:CheckBoxList ID="chklst" runat="server" >

<asp:ListItem>c</asp:ListItem>

<asp:ListItem>c++</asp:ListItem>

<asp:ListItem>cpp</asp:ListItem>

<asp:ListItem>java</asp:ListItem>

<asp:ListItem>php</asp:ListItem>

</asp:CheckBoxList>

<asp:Button ID="btn_1" Text="Submit" runat="server" onclick="btn_1_Click"


/> <br /><br />

<asp:Label ID="Label11" runat="server" Text="Label"></asp:Label><br /><br


/>

<asp:Label ID="Label12" runat="server" Text="Label"></asp:Label><br /><br


/>

<asp:Label ID="Label13" runat="server" Text="Label"></asp:Label><br /><br


/>

<asp:Label ID="Label14" runat="server" Text="Label"></asp:Label><br /><br


/>

<asp:Label ID="Label15" runat="server" Text="Label"></asp:Label><br /><br


/>

<asp:Label ID="Label16" runat="server" Text="Label"></asp:Label><br />

</div>

</form>

</body>

</html>
Default.aspx.cs

using System;

using System.Collections.Generic;

using System.Linq;

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 btn_1_Click(object sender, EventArgs e)

Label11.Text = "Your first name is:" + txt_fn.Text;

Label12.Text = "Your Last name is:" + txt_ln.Text;

Label13.Text = "Your Address is:" + txt_add.Text;

if (r_male.Checked)

Label14.Text = "Your gender is:" + r_male.Text;

else

{
Label14.Text = "Your gender is:" + r_female.Text;

Label15.Text = "Your faviourate color is:" + dropdownlist1.SelectedItem;

Label16.Text = "Your faviourate sub are:";

foreach (ListItem lst in chklst.Items)

if (lst.Selected == true)

Label16.Text += "<br>" + lst.Text;

Label16.Text += "<br>";

O/P:-
3.b).
Default.aspx.cs

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"


Inherits="_Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<div>

<asp:Calendar ID="Calendar1" runat="server" BackColor="#FFFFCC"

BorderColor="#FFCC66" BorderWidth="1px" Font-Names="Verdana" Font-


Size="8pt"

ForeColor="#663399" Height="200px"

ondayrender="Calendar1_DayRender"

onselectionchanged="Calendar1_SelectionChanged" Width="220px"
DayNameFormat="Shortest" ShowGridLines="True">

<DayHeaderStyle Font-Bold="True" BackColor="#FFCC66" Height="1px" />

<NextPrevStyle Font-Size="9pt" ForeColor="#FFFFCC" />

<OtherMonthDayStyle ForeColor="#CC9966" />

<SelectedDayStyle BackColor="#CCCCFF" Font-Bold="True" />

<SelectorStyle BackColor="#FFCC66" />

<TitleStyle BackColor="#990000"

Font-Bold="True" Font-Size="9pt" ForeColor="#FFFFCC" />

<TodayDayStyle BackColor="#FFCC66" ForeColor="White" />


</asp:Calendar>

<br />

<asp:Label ID="Label1" runat="server" Text=""></asp:Label>

<br />

<br />

<asp:Label ID="Label2" runat="server" Text=""></asp:Label>

<br />

<br />

<asp:Label ID="Label3" runat="server" Text=""></asp:Label>

<br />

<br />

<asp:Label ID="Label4" runat="server" Text=""></asp:Label>

<br />

<br />

<asp:Label ID="Label5" runat="server" Text=""></asp:Label>

<br />

<br />

<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Result"


style="height: 26px" />

&nbsp;&nbsp;&nbsp;

<asp:Button ID="Button2" runat="server" Text="Reset" />

</div>

</form>

</body>
</html>

Default.aspx.cs

using System;

using System.Collections.Generic;

using System.Linq;

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)

if (!IsPostBack)

Calendar1.Visible = true;

protected void Button1_Click(object sender, EventArgs e)

Calendar1.Caption = "Calendar";

Label2.Text = "Today's Date = " + Calendar1.TodaysDate.ToString();

Label3.Text = "New year is at : 01-01-2019";

TimeSpan d = new DateTime(2019, 1, 1) - DateTime.Now;

Label4.Text = "New year is after = " + d.Days.ToString() + "days";


}

protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)

if (e.Day.Date.Day == 22 && e.Day.Date.Month == 9)

e.Cell.Controls.Add(new LiteralControl("<br/>holiday"));

if (e.Day.Date >= new DateTime(2018, 9, 13) && e.Day.Date <= new


DateTime(2018, 9, 18))

e.Cell.BackColor = System.Drawing.Color.Green;

e.Cell.BorderColor = System.Drawing.Color.White;

if (e.Day.IsOtherMonth)

e.Day.IsSelectable = false;

e.Cell.BackColor = System.Drawing.Color.Green;

protected void Calendar1_SelectionChanged(object sender, EventArgs e)

Label1.Text = "Your selected date is = " +


Calendar1.SelectedDate.ToShortDateString();

protected void Button2_Click(object sender, EventArgs e)

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

Label3.Text = "";

Label4.Text = "";

Label5.Text = "";

Calendar1.SelectedDates.Clear();

O/P:_
3.c

Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"


Inherits="_Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<div>

Treeview control navigation:<asp:TreeView ID = "TreeView1" runat =


"server" Width =

"150px" ImageSet="Arrows">

<HoverNodeStyle Font-Underline="True" ForeColor="#5555DD" />

<Nodes>

<asp:TreeNode Text = "ASP.NET Practs" Value = "New Node">

<asp:TreeNode Text = "Calendar Control" Value = "RED"


NavigateUrl="~/calndrCtrl.aspx">

</asp:TreeNode>

<asp:TreeNode Text = "Constructor Overloading" Value = "GREEN"

NavigateUrl="~/clsconstrc.aspx"> </asp:TreeNode>
<asp:TreeNode NavigateUrl="~/singleInh.aspx" Text="Inheritance"

Value="BLUE"></asp:TreeNode>

<asp:TreeNode NavigateUrl="~/clsProp.aspx" Text="Class Properties" Value="Class

Properties"></asp:TreeNode>

</asp:TreeNode>

</Nodes>

<NodeStyle Font-Names="Tahoma" Font-Size="10pt" ForeColor="Black"

HorizontalPadding="5px" NodeSpacing="0px" VerticalPadding="0px" />

<ParentNodeStyle Font-Bold="False" />

<SelectedNodeStyle Font-Underline="True" ForeColor="#5555DD"

HorizontalPadding="0px" VerticalPadding="0px" />

</asp:TreeView>

<br />

Fetch Datalist Using XML data : </div>

<asp:DataList ID="DataList1" runat="server"


OnSelectedIndexChanged="DataList1_SelectedIndexChanged">

<ItemTemplate>

<table class = "table" border="1">

<tr>

<td>Roll Num : <%# Eval("sid") %><br />

Name : <%# Eval("sname") %><br />

Class : <%# Eval("sclass")%>

</td>

</tr>

</table>
</ItemTemplate>

</asp:DataList>

</form>

</body>

</html>

Default.aspx.cs

using System;

using System.Collections.Generic;

using System.Data;

using System.Linq;

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)

if (!IsPostBack)

BindData();

protected void DataList1_SelectedIndexChanged(object sender, EventArgs e)

{
}

protected void BindData()

DataSet ds = new DataSet();

ds.ReadXml(Server.MapPath("XMLFile.xml"));

if (ds != null && ds.HasChanges())

DataList1.DataSource = ds;

DataList1.DataBind();

else

DataList1.DataBind();

XMLFile.xml

<?xml version="1.0" encoding="utf-8" ?>

<studentdetail>

<student>

<sid>1</sid>

<sname>Sandeep</sname>

<sclass>TYIT</sclass>
</student>

<student>

<sid>2</sid>

<sname>Mahesh</sname>

<sclass>SYIT</sclass>

</student>

<student>

<sid>3</sid>

<sname>Sid</sname>

<sclass>TYIT</sclass>

</student>

</studentdetail>

o/p:-
4.a)

Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"


Inherits="_Default" %>

<!DOCTYPE html>

<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" Text="Enter First name:">

</asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp:&nbsp;&nbs
p;&nbsp; <asp:TextBox ID="fn_txt" runat="server"></asp:TextBox>

<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"

ControlToValidate="fn_txt" ErrorMessage="Enter first name"

ForeColor="Red"></asp:RequiredFieldValidator> <br /> <br />

<asp:Label ID="Label2" runat="server" Text="Enter last name:"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp

:&nbsp;&nbsp;&nbsp;&nbsp;

<asp:TextBox ID="ln_txt" runat="server"></asp:TextBox>

<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"


ControlToValidate="ln_txt"

ErrorMessage="Enter last name" ForeColor="#FF3300"></asp:RequiredFieldValidator>

<br /> <br />

<asp:Label ID="Label3" runat="server" Text="Enter Password:"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp

:&nbsp;&nbsp;&nbsp;&nbsp;

<asp:TextBox ID="pwd_txt" runat="server" TextMode="Password"></asp:TextBox>

<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"


ControlToValidate="pwd_txt"

ErrorMessage="Enter password" ForeColor="#FF3300"></asp:RequiredFieldValidator>

<br /> <br />

<asp:Label ID="Label4" runat="server" Text="Confirmed Password"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="cpwd_txt" runat="server" TextMode="Password"></asp:TextBox>
&nbsp;

<asp:CompareValidator ID="CompareValidator1" runat="server"


ControlToCompare="pwd_txt"

ControlToValidate="cpwd_txt" ErrorMessage="Password must be same"

ForeColor="#FF3300"></asp:CompareValidator>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<br /> <br />

<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Submit" />

<br />

<br />

<asp:Label ID="Label7" runat="server" Enabled="False"


Text="Label"></asp:Label>

<br /> <br /> <asp:Label ID="ans" runat="server" Text="answer"></asp:Label>

<br /> <br /> <br />

</div>

</form>

</body>

</html>

Default.aspx.cs
using System;

using System.Collections.Generic;

using System.Linq;

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)

this.UnobtrusiveValidationMode =
System.Web.UI.UnobtrusiveValidationMode.None;

protected void Button1_Click(object sender, EventArgs e)

if (this.IsValid)

ans.Text = "data saved";

ans.ForeColor = System.Drawing.Color.Green;

else

ans.Text = "data notsaved";

ans.ForeColor = System.Drawing.Color.Red;
}

Label7.Text = "your First name is = " + fn_txt.Text + "<br>Your Last name


is = " + ln_txt.Text;

o/p:-

4.b

Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"


Inherits="_Default" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<div>

<asp:AdRotator ID="AdRotator1" runat="server"


Advertisementfile="~/XMLFile.xml" BackColor="Black" />

</div>

</form>

</body>

</html>

XMLFile1.xml

<?xml version="1.0" encoding="utf-8" ?>

<Advertisements>

<Ad>

<ImageUrl>~/pic/Google.jpg</ImageUrl>

<NavigateUrl>http://google.com</NavigateUrl>
<AlternateText>Please visit google</AlternateText>

<Impressions>10</Impressions>

<Keyword>Support</Keyword>

</Ad>

<Ad>

<ImageUrl>~/pic/youtube.jpg</ImageUrl>

<NavigateUrl>http://youtube.com</NavigateUrl>

<AlternateText>Please visit youtube</AlternateText>

<Impressions>60</Impressions>

<Keyword>Youtube</Keyword>

</Ad>

</Advertisements>

o/p:-
4.c

WebUserControl.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs"


Inherits="WebUserControl" %>

<asp:Label ID="Label1" runat="server" Text="Enter Name:"></asp:Label>

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Submit"


/>

<br />

<asp:Label ID="Label2" runat="server" Text="label"></asp:Label>

WebUserControl.ascx.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

public partial class WebUserControl : System.Web.UI.UserControl

protected void Page_Load(object sender, EventArgs e)


{

protected void Button1_Click(object sender, EventArgs e)

Label2.Text = "Your name is = " + TextBox1.Text;

Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"


Inherits="_Default" %>

<%@ Register Src="~/WebUserControl.ascx" TagPrefix="uc1" TagName="WebUserControl"


%>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">


<div>

<uc1:WebUserControl runat="server" ID="WebUserControl" />

</div>

</form>

</body>

</html>

o/p:-

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy