0% found this document useful (0 votes)
3 views2 pages

ASP Programs

Uploaded by

praneshar205
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)
3 views2 pages

ASP Programs

Uploaded by

praneshar205
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

Bind a ListBox with an array of colors and change background color of the page

accordingly in [Link]
[Link]
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="[Link]"
Inherits="Color" %>

<!DOCTYPE html>
<html>
<head runat="server">
<title>Color ListBox</title>
</head>
<body id="bodyTag" runat="server">
<form id="form1" runat="server">

<asp:ListBox ID="ListBox1" runat="server" AutoPostBack="true"


OnSelectedIndexChanged="ListBox1_SelectedIndexChanged">
</asp:ListBox>

</form>
</body>
</html>

[Link]
using System;

public partial class Color : [Link]


{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string[] colors = { "Red", "Green", "Blue", "Yellow", "Pink", "Orange" };

[Link] = colors;
[Link]();
}
}

protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)


{
[Link]["background-color"] = [Link];
}
}
Create an [Link] page and use the Page Load method to display the current
date and time. in [Link]

[Link]
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="[Link]"
Inherits="DateTimePage" %>

<!DOCTYPE html>
<html>
<head runat="server">
<title>Date and Time</title>
</head>
<body>
<form id="form1" runat="server">

<h2>Current Date and Time:</h2>

<asp:Label ID="Label1" runat="server" Font-Size="Large"></asp:Label>

</form>
</body>
</html>

[Link]
using System;

public partial class DateTimePage : [Link]


{
protected void Page_Load(object sender, EventArgs e)
{
// Display current date and time
[Link] = [Link]();
}
}

You might also like