Académique Documents
Professionnel Documents
Culture Documents
a) Create a simple web page with various sever controls to demonstrate setting and use
of their properties. (Example : AutoPostBack)
GUI:-
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form2" runat="server">
<div>
<p id="l1">
choose a background colour</p>
<asp:DropDownList ID="dl1" runat="server" Height="20px" Width="127px">
</asp:DropDownList>
<p id="l2">
Page 1
T.Y.B.Sc. (I.T.) – Advanced Web Programming –Paper (III) [Your Roll No]
Choose a font
</p>
<p>
<asp:DropDownList ID="dl2" runat="server">
</asp:DropDownList>
</p>
<p id="l3">
Font size</p>
<p>
<asp:TextBox ID="t1" runat="server" OnTextChanged="t1_TextChanged"></asp:TextBox>
</p>
<p id="l4">
Choose a border style</p>
<p>
<asp:RadioButtonList ID="rb1" runat="server">
<asp:ListItem>None</asp:ListItem>
<asp:ListItem>Double</asp:ListItem>
<asp:ListItem>Solid</asp:ListItem>
</asp:RadioButtonList>
</p>
<p>
<asp:CheckBox ID="c1" runat="server" Text="Add a default picture" />
</p>
<p id="l5">
Greeting text</p>
<p>
<asp:TextBox ID="t2" runat="server" Height="68px" Width="228px"></asp:TextBox>
</p>
<p>
<asp:Button ID="b1" runat="server" OnClick="b1_Click" Text="Update" style="height: 26px" />
</p>
<p>
</p>
</div>
<asp:Panel ID="p1" runat="server" Width="339px" Height="481px" HorizontalAlign="Center"
Style="POSITION: absolute; TOP: 16px; LEFT: 313px;" >
<br/>
<br />
<br />
<br />
<asp:Label ID="Lp6" runat="server"></asp:Label>
<br />
<br />
<br />
<br />
<br />
<br />
<asp:Image ID="i1" runat="server" />
Page 2
T.Y.B.Sc. (I.T.) – Advanced Web Programming –Paper (III) [Your Roll No]
</asp:Panel>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Drawing.Text;
using System.ComponentModel;
namespace WebApplications
{
public partial class card : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
//Assign colours list
string[] colourArray = Enum.GetNames(typeof(KnownColor));
dl1.DataSource = colourArray;
dl1.DataBind();
dl1.SelectedIndex = 0;
}
}
p1.BackColor = Color.FromName(dl1.SelectedItem.Text);
Page 3
T.Y.B.Sc. (I.T.) – Advanced Web Programming –Paper (III) [Your Roll No]
Lp6.Font.Name = dl2.SelectedItem.Text;
if (c1.Checked)
{
i1.Visible = true;
i1.ImageUrl = "Images/Penguins.jpg";
}
else
{
i1.Visible = false;
}
Lp6.Text = t2.Text;
TypeConverter converter = TypeDescriptor.GetConverter(typeof(BorderStyle));
p1.BorderStyle = (BorderStyle)converter.ConvertFromString(rb1.SelectedItem.Text);
Lp6.Font.Name = dl2.SelectedItem.Text;
Lp6.Font.Name = dl2.SelectedItem.Text;
if (Int32.Parse(t1.Text) > 0)
{
Lp6.Font.Size = FontUnit.Point(Int32.Parse(t1.Text));
}
}
}
}
}
Output:-
Page 4
T.Y.B.Sc. (I.T.) – Advanced Web Programming –Paper (III) [Your Roll No]
c) Selected day in a calendar control using style d) Difference between two calendar dates
GUI:-
Page 5
T.Y.B.Sc. (I.T.) – Advanced Web Programming –Paper (III) [Your Roll No]
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Page 6
T.Y.B.Sc. (I.T.) – Advanced Web Programming –Paper (III) [Your Roll No]
</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;
namespace WebApplicationsDiv2
{
public partial class CalenderControl : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
lbldates.Text = "You Selected these Dates:<br>";
foreach (DateTime dt in Calendar1.SelectedDates)
{
Page 7
T.Y.B.Sc. (I.T.) – Advanced Web Programming –Paper (III) [Your Roll No]
Page 8
T.Y.B.Sc. (I.T.) – Advanced Web Programming –Paper (III) [Your Roll No]
}
}
Output:-
Page 9
T.Y.B.Sc. (I.T.) – Advanced Web Programming –Paper (III) [Your Roll No]
Page 10