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

Name:Swagatipachare Date:10/4/24 Default - Aspx

The document describes an ASP.NET web application that implements various web controls like dropdown lists, text boxes and buttons. It includes code files for the default page and code behind to handle control events like button clicks.

Uploaded by

Aashish Pandey
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)
19 views2 pages

Name:Swagatipachare Date:10/4/24 Default - Aspx

The document describes an ASP.NET web application that implements various web controls like dropdown lists, text boxes and buttons. It includes code files for the default page and code behind to handle control events like button clicks.

Uploaded by

Aashish Pandey
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
You are on page 1/ 2

P18:Desgin an ASP.

NET application for web controls and their implementation


Name:SwagatiPachare
Date:10/4/24
Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!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 id="Head1" runat="server">
<title>Web Controls </title>
</head>
<body>
<form id="form1" runat="server">
<div style="height: 253px; width: 939px">
<asp:Label ID="lblMessage" runat="server" Text="Select an item and enter some text:"></asp:Label>
<br />
<asp:DropDownList ID="ddlItems" runat="server">
<asp:ListItem>Name</asp:ListItem>
<asp:ListItem>Age</asp:ListItem>
<asp:ListItem>Location</asp:ListItem>
</asp:DropDownList>
<br />
<br />
<asp:TextBox ID="txtInput" runat="server" Width="200px"></asp:TextBox>
<br />
<br />
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" />
<br />
<br />
<asp:Label ID="lblOutput" runat="server" Text=""></asp:Label>
</div>
</form>
</body>
</html>

Default.aspx.cs
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class _Default : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// Initialize the dropdown list and text box if it's the first load
ddlItems.SelectedIndex = 0;
txtInput.Text = string.Empty;
}
}

protected void btnSubmit_Click(object sender, EventArgs e)


{
// Display the selected item and the entered text
lblOutput.Text = "Hello";

}
}

Output:

You might also like