Practical 3 A, B, C
Practical 3 A, B, C
Practical 3 A, B, C
3 A
Aim: Create an a simple web page with various server controls to demonstrate setting and use of their properties .
(Example : AutoPostBack)
Code:
1] webForm1.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style3 {
width: 101px;
}
.auto-style6 {
width: 101px;
height: 24px;
}
.auto-style8 {
width: 101px;
height: 23px;
}
.auto-style9 {
width: 12px;
height: 24px;
}
.auto-style10 {
width: 12px;
}
.auto-style11 {
width: 12px;
height: 23px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<table class="auto-style1">
<tr>
<td class="auto-style9">
<asp:Label ID="Label1" runat="server" Text="Roll No"></asp:Label>
</td>
<td class="auto-style6">
<asp:TextBox ID="TextBox2" runat="server" AutoPostBack="True"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style10">
<asp:Label ID="Label2" runat="server" Text="Name"></asp:Label>
</td>
<td class="auto-style3">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style10">
<asp:Label ID="Label3" runat="server" Text="Class"></asp:Label>
</td>
<td class="auto-style3">
<asp:RadioButton ID="RadioButton1" runat="server" AutoPostBack="True" GroupName="class"
Text="FY" />
<asp:RadioButton ID="RadioButton2" runat="server" AutoPostBack="True" GroupName="class"
Text="SY" />
<asp:RadioButton ID="RadioButton3" runat="server" AutoPostBack="True" GroupName="class"
Text="TY" />
</td>
</tr>
<tr>
<td class="auto-style11">
<asp:Label ID="Label4" runat="server" Text="Course"></asp:Label>
</td>
<td class="auto-style8">
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem>BSc.IT</asp:ListItem>
<asp:ListItem>BCOM</asp:ListItem>
<asp:ListItem>BA</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="auto-style11"></td>
<td class="auto-style8">
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
</td>
</tr>
<tr>
<td class="auto-style10">
<asp:Label ID="Label5" runat="server" Text="label"></asp:Label>
</td>
<td class="auto-style3"> </td>
</tr>
</table>
<div>
</div>
</form>
</body>
</html>
2] webForm1.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace practicalno3A
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
PRACTICAL NO. 3 B
Code:
1] webForm1.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>
</form>
</body>
</html>
2] webForm1.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace practical3BCalender
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
}
}
PRACTICAL NO. 3 C
Code:
1]WebForm1.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:TreeView ID="TreeView1" runat="server"
OnSelectedNodeChanged="TreeView1_SelectedNodeChanged"
OnTreeNodeCollapsed="TreeView1_TreeNodeCollapsed">
<Nodes>
<asp:TreeNode Checked="True" ShowCheckBox="True" Text="Courses" Value="Courses">
<asp:TreeNode Checked="True" ShowCheckBox="True" Text="BSc.IT" Value="BSc.IT">
<asp:TreeNode Checked="True" ShowCheckBox="True" Text="FYIT"
Value="FYIT"></asp:TreeNode>
<asp:TreeNode Checked="True" ShowCheckBox="True" Text="SYIT"
Value="SYIT"></asp:TreeNode>
<asp:TreeNode Checked="True" ShowCheckBox="True" Text="TYIT"
Value="TYIT"></asp:TreeNode>
</asp:TreeNode>
<asp:TreeNode Checked="True" ShowCheckBox="True" Text="BCOM" Value="BCOM">
<asp:TreeNode Checked="True" ShowCheckBox="True" Text="FYBCOM"
Value="FYBCOM"></asp:TreeNode>
<asp:TreeNode Checked="True" ShowCheckBox="True" Text="SYBCOM"
Value="SYBCOM"></asp:TreeNode>
<asp:TreeNode Checked="True" ShowCheckBox="True" Text="TYBCOM"
Value="TYBCOM"></asp:TreeNode>
</asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
</div>
</form>
</body>
</html>
2] WebForm1.aspx.cs :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace practical3CtreeViewOperation
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
{
Response.Write("You Have Selected The Option: " + TreeView1.SelectedValue);
}
protected void TreeView1_TreeNodeCollapsed(object sender,TreeNodeEventArgs e)
{
Response.Write("The Value Collapsed Was : " + e.Node.Value);
}
}
}