Q1.
Code
WebForm1.aspx
<body>
<form id="form1" runat="server">
<div style="height: 171px; width: 719px;">
<p>
Click on any of the first three images to display it at the bottom</p>
<p>
Click on the bottom image to clear it</p>
</div>
<div style="height: 192px">
<asp:ImageButton ID="ImageButton1" runat="server"
ImageUrl="~/Chrysanthemum.jpg" onclick="ImageButton1_Click" Width="105px" />
<asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/Desert.jpg"
Width="124px" onclick="ImageButton2_Click" />
<asp:ImageButton ID="ImageButton3" runat="server" ImageUrl="~/index.jpg"
onclick="ImageButton3_Click" Width="109px" />
</div>
<div>
<hr />
<asp:ImageButton ID="ImageButton4" runat="server"
onclick="ImageButton4_Click" Height="50px" Width="50px" />
</div>
</form>
</body>
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 WebApplication1
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
ImageButton4.ImageUrl = "~/Chrysanthemum.jpg";
}
protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
{
ImageButton4.ImageUrl = "~/Desert.jpg";
}
protected void ImageButton3_Click(object sender, ImageClickEventArgs e)
{
ImageButton4.ImageUrl = "~/index.jpg";
}
protected void ImageButton4_Click(object sender, ImageClickEventArgs e)
{
ImageButton4.ImageUrl = "";
}
}
}
Q3. Code
.aspx file
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="WebApplication3.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<p> <asp:Label ID="Label1" runat="server" Text="CourseWork Feedback
form"></asp:Label></p>
<asp:Label ID="Label2" runat="server" Text="Student
name:"></asp:Label><asp:TextBox
ID="TextBox1" runat="server"></asp:TextBox>
<p style="height: 307px"><asp:Label ID="Label3" runat="server"
Text="Gender"></asp:Label>
<asp:RadioButton ID="RadioButton5" runat="server" Text="Male"
GroupName="gender" />
<asp:RadioButton ID="RadioButton6" runat="server" Text="Female"
GroupName="gender"/>
</br>
<asp:Label ID="Label4" runat="server" Text="Select
Course"></asp:Label><asp:DropDownList
ID="DropDownList1" runat="server">
<asp:ListItem Text="Select Course"></asp:ListItem>
<asp:ListItem Text="ASP-XML"></asp:ListItem>
<asp:ListItem Text="DOY-NET"></asp:ListItem>
<asp:ListItem Text="JAVAPro"></asp:ListItem>
<asp:ListItem Text="Unix"></asp:ListItem>
<asp:ListItem Text="C"></asp:ListItem>
<asp:ListItem Text="C++"></asp:ListItem>
</asp:DropDownList></br>
<asp:Label ID="Label5" runat="server" Text="Technical
Coverage:"></asp:Label></br>
<asp:RadioButton ID="RadioButton1" runat="server" Text="Excellent"
GroupName="radio"/></br>
<asp:RadioButton ID="RadioButton2" runat="server" Text="Good"
GroupName="radio"/></br>
<asp:RadioButton ID="RadioButton3" runat="server" Text="Average"
GroupName="radio"/> </br>
<asp:RadioButton ID="RadioButton4" runat="server" Text="Poor"
GroupName="radio"/></br>
<asp:TextBox ID="TextBox2" runat="server" TextMode="MultiLine"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Submit Form"
onclick="Button1_Click" /></br>
</br></br></br></br></br>
<asp:Label ID="Label6" runat="server" Text="Label"></asp:Label>
</p>
</div>
</form>
</body>
</html>
.aspx.cs file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication3
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
protected void Button1_Click(object sender, EventArgs e)
{
Label6.Text = "Thanks " + TextBox1.Text;
}
}
}
Q4. Code
.aspx file
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="WebApplication4.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div style="height: 459px">
<asp:ListBox ID="ListBox1" runat="server"
Height="88px"
Width="90px" onselectedindexchanged="ListBox1_SelectedIndexChanged">
<asp:ListItem Text="Bread" Value="0"/>
<asp:ListItem Text="Butter" Value="1"/>
<asp:ListItem Text="Biscuit" Value="2"/>
</asp:ListBox>
<asp:Image ID="Image1" runat="server" Width="84px" />
<asp:Button ID="Button1" runat="server" Text="Show Price"
onclick="Button1_Click" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
.aspx.cs file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication4
{
public partial class WebForm1 : System.Web.UI.Page
{
// int j;
protected void Page_Load(object sender, EventArgs e)
{
protected void Button1_Click(object sender, EventArgs e)
{
int i = ListBox1.SelectedIndex;
if (i == 0)
Label1.Text = "35";
else if (i == 1)
Label1.Text = "50";
else
Label1.Text = "40";
protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
int j = ListBox1.SelectedIndex;
if (j == 0)
Image1.ImageUrl = "bread.jpg";
else if (j == 1)
Image1.ImageUrl = "butter.jpg";
else if (j == 2)
Image1.ImageUrl = "biscuit.jpg";
}
}
}
Q5.
.aspx
Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="WebApplication5.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div style="height: 358px">
<asp:Label ID="Label1" runat="server" Text="ID"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox>
</br>
<asp:Label ID="Label2" runat="server" Text="NAME"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</br>
<asp:Label ID="Label3" runat="server" Text="PRICE"></asp:Label>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</br>
<asp:Label ID="Label4" runat="server" Text="Qty"></asp:Label>
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
</div>
</form>
</body>
</html>
.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication5
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Text = "10";
TextBox2.Text = "Wheat";
TextBox3.Text = "14.25";
TextBox4.Text = "1000";
}
}
Q7.
Q8.
.ASPX FILE
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="WebApplication7.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div style="height: 195px">
<asp:Label ID="Label1" runat="server" Text="UserId"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</br>
<asp:Label ID="Label2" runat="server" Text="Password"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</br>
</br>
<asp:Button ID="Button1" runat="server" Text="Login" onclick="Button1_Click" />
</br>
</br>
<asp:Label ID="Label3" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
.aspx.cs file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication7
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
protected void Button1_Click(object sender, EventArgs e)
{
if ((TextBox1.Text=="University") && (TextBox2.Text=="BCA COURSE"))
Label3.Text="Authorized User";
else
Label3.Text="Unauthorized User";
}
}
}
Q9.
.aspx
Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="WebApplication8.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div style="height: 356px">
<asp:Label ID="Label1" runat="server" Text="First Number"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</BR>
<asp:Label ID="Label2" runat="server" Text="Second Number"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<asp:Label ID="Label3" runat="server" Text="Select Operation"></asp:Label>
<asp:DropDownList ID="DropDownList1" runat="server" Height="16px" Width="124px">
<asp:ListItem Text="Select Operation"></asp:ListItem>
<asp:ListItem Text="Add"></asp:ListItem>
<asp:ListItem Text="Subtract"></asp:ListItem>
</asp:DropDownList>
<br />
<br />
<br />
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Show Result"
onclick="Button1_Click" />
</br>
</br>
<asp:Label ID="Label4" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
.axpx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication8
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
protected void Button1_Click(object sender, EventArgs e)
{
int i = DropDownList1.SelectedIndex;
int result, a, b;
a = Convert.ToInt32(TextBox1.Text);
b = Convert.ToInt32(TextBox2.Text);
if (i == 1)
{ result = a + b;
Label4.Text = "Result is" + result;
}
else if (i == 2)
{
result = a - b;
Label4.Text = "Result is" + Convert.ToInt32(result);
}
else
Label4.Text = "Select some operation";
}
}
}
Q10.