Subject: Advance Web Programing: 1) Aishwarya Waghmare (62) 2) Sandeep Singh (55) Subject Sir: Kiran More
Subject: Advance Web Programing: 1) Aishwarya Waghmare (62) 2) Sandeep Singh (55) Subject Sir: Kiran More
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>
<div>
<br />
<br />
&nbs
p;
</div>
<br />
<br />
<br />
<br />
<p>
</p>
&nbs
p;
<br />
</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;
{
int r;
r = Convert.ToInt32(TextBox1.Text) * Convert.ToInt32(TextBox2.Text) *
Convert.ToInt32(TextBox3.Text) * Convert.ToInt32(TextBox4.Text);
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>
<div>
<br />
<br />
<br />
<br />
</div>
<br />
<br />
<br />
<br />
<br />
<br />
</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;
{
string s = TextBox1.Text;
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
class Program
Console.ReadKey();
}
2. Working with Object Oriented C# and ASP .NET
Default.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
<div id="fibb">
&nbs
p;
<br />
&nbs
p;
&nbs
p;
&nbs
p;
<br />
<br />
<br />
<br />
<br />
<br />
&nbs
p;
<br />
<br />
&nbs
p;
<br />
<br />
</div>
&nbs
p;
&nbs
p;
<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;
int a, b, c, i, n;
a = 0;
b = 1;
n = Convert.ToInt32(TextBox1.Text);
c = a + b;
a = b;
b = c;
}
protected void Button2_Click(object sender, EventArgs e)
int i, c = 0, j, num;
num = Convert.ToInt32(TextBox2.Text);
i = num % j;
if (i == 0)
c = c + 1;
if (c == 2)
else
i = num % 10;
Label9.Text = sum.ToString();
num = Convert.ToInt32(TextBox4.Text);
i = num % 10;
sum = i + sum;
Label10.Text = sum.ToString();
char c = Convert.ToChar(TextBox5.Text);
switch (c)
case 'a':
break;
case 'e':
break;
case 'i':
break;
case 'o':
break;
case 'u':
break;
default:
break;
}
2. Working with Object Oriented C# and ASP .NET
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
number = Convert.ToInt32(TextBox1.Text);
fact = number;
fact = fact * i;
}
ii money conversion
Default.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
<br />
<br />
&nbs
p;
<br />
<br />
<br />
<br />
<br />
&nbs
p;
<br />
<br />
<br />
&nbs
p;
&nbs
p;
<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;
}
protected void Button1_Click1(object sender, EventArgs e)
double r = Convert.ToDouble(TextBox1.Text);
Label6.Text = rate.ToString();
double r = Convert.ToDouble(TextBox1.Text);
Label7.Text = rate.ToString();
double r = Convert.ToDouble(TextBox1.Text);
Label8.Text = rate.ToString();
{
curConv s = new curConv();
double r = Convert.ToDouble(TextBox1.Text);
Label9.Text = rate.ToString();
r = r * 0.015;
return r;
r = r * 0.012;
return r;
r = r * 0.0011;
return 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>
<div>
<br />
<br />
&nbs
p;
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
return temp;
return temp;
}
public partial class _Default : System.Web.UI.Page
double n = Convert.ToDouble(TextBox1.Text);
double x = s.ctof(n);
Label3.Text = x.ToString();
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>
<div>
<br />
<br />
<br />
<br />
</div>
<br />
</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;
return a + a;
{
return a + b;
return a + b + c;
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>
<div>
<br />
<br />
<br />
<br />
<br />
<br />
</div>
</form>
<p>
</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;
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 class B : A
return val1*val1*val1;
multilevel.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
<br />
<br />
<br />
&nbs
p;
<br />
<br />
</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;
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 class B : A
Hierarchical.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</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;
B s1 = new B();
C s2 = new C();
int m = Convert.ToInt32(TextBox1.Text);
int n= Convert.ToInt32(TextBox2.Text);
Label3.Text = x.ToString();
Label4.Text = y.ToString();
public class A
public int a;
public int b;
}
public class B : A
a = val1;
b = val2;
return a + b;
public class C : A
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>
<div>
<br />
<br />
<br />
<br />
</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;
Label2.Text = obj1.r.ToString();
Label3.Text = obj2.r.ToString();
Label4.Text = obj3.r.ToString();
public int r;
public add(int a)
r = a + a;
r = a + b;
r = a + b + c;
}
intfc.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
<h1>Interface:</h1>
<br />
Enter String:
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</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
show_i1();
show_i2();
}
Delegate
demo_delegate.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
</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;
string s1 = "sandeep";
return s1;
return s2;
}
protected void Page_Load(object sender, EventArgs e)
d1();
d2();
Label1.Text = d1();
Label2.Text = d2();
operations.
control
c) Selected day in a calendar control using style d) Difference between two calendar
dates
3.a).
Default.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
: <asp:TextBox
runat="server"
ID="txt_fn" AutoPostBack="True"/>
ID="txt_ln" AutoPostBack="True"/>
:- <asp:DropDownList
<asp:ListItem>red</asp:ListItem>
<asp:ListItem>blue</asp:ListItem>
<asp:ListItem>green</asp:ListItem>
<asp:ListItem>black</asp:ListItem>
<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>
</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;
if (r_male.Checked)
else
{
Label14.Text = "Your gender is:" + r_female.Text;
if (lst.Selected == true)
Label16.Text += "<br>";
O/P:-
3.b).
Default.aspx.cs
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
ForeColor="#663399" Height="200px"
ondayrender="Calendar1_DayRender"
onselectionchanged="Calendar1_SelectionChanged" Width="220px"
DayNameFormat="Shortest" ShowGridLines="True">
<TitleStyle BackColor="#990000"
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<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;
if (!IsPostBack)
Calendar1.Visible = true;
Calendar1.Caption = "Calendar";
e.Cell.Controls.Add(new LiteralControl("<br/>holiday"));
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;
Label1.Text = "";
Label2.Text = "";
Label3.Text = "";
Label4.Text = "";
Label5.Text = "";
Calendar1.SelectedDates.Clear();
O/P:_
3.c
Default.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
"150px" ImageSet="Arrows">
<Nodes>
</asp:TreeNode>
NavigateUrl="~/clsconstrc.aspx"> </asp:TreeNode>
<asp:TreeNode NavigateUrl="~/singleInh.aspx" Text="Inheritance"
Value="BLUE"></asp:TreeNode>
Properties"></asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
<br />
<ItemTemplate>
<tr>
</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;
if (!IsPostBack)
BindData();
{
}
ds.ReadXml(Server.MapPath("XMLFile.xml"));
DataList1.DataSource = ds;
DataList1.DataBind();
else
DataList1.DataBind();
XMLFile.xml
<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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
</asp:Label>
 : &nbs
p; <asp:TextBox ID="fn_txt" runat="server"></asp:TextBox>
 
:
 
:
:
<asp:TextBox ID="cpwd_txt" runat="server" TextMode="Password"></asp:TextBox>
ForeColor="#FF3300"></asp:CompareValidator>
<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;
this.UnobtrusiveValidationMode =
System.Web.UI.UnobtrusiveValidationMode.None;
if (this.IsValid)
ans.ForeColor = System.Drawing.Color.Green;
else
ans.ForeColor = System.Drawing.Color.Red;
}
o/p:-
4.b
Default.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
</div>
</form>
</body>
</html>
XMLFile1.xml
<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>
<Impressions>60</Impressions>
<Keyword>Youtube</Keyword>
</Ad>
</Advertisements>
o/p:-
4.c
WebUserControl.ascx
<br />
WebUserControl.ascx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
Default.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
</div>
</form>
</body>
</html>
o/p:-