WEB CONTROLS
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="[Link]"
Inherits="WebControlsApp.WebForm1" %>
<!DOCTYPE html>
<html xmlns="[Link]
<head runat="server">
<title>Web Controls Example</title>
</head>
<body>
<form id="form1" runat="server">
<div style="padding: 20px; width: 300px; border: 1px solid #ccc;">
<h2>Registration Form</h2>
<asp:Label ID="Label1" runat="server" Text="Name:"
AssociatedControlID="txtName"></asp:Label><br />
<asp:TextBox ID="txtName" runat="server"></asp:TextBox><br /><br />
<asp:Label ID="Label2" runat="server" Text="Gender:"></asp:Label><br />
<asp:DropDownList ID="ddlGender" runat="server">
<asp:ListItem Text="Select" Value=""></asp:ListItem>
<asp:ListItem Text="Male" Value="Male"></asp:ListItem>
<asp:ListItem Text="Female" Value="Female"></asp:ListItem>
</asp:DropDownList><br /><br />
<asp:CheckBox ID="chkAgree" runat="server" Text="I agree to the terms." /><br /><br />
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click"
/><br /><br />
<asp:Label ID="lblResult" runat="server" ForeColor="Green"></asp:Label>
</div>
</form>
</body>
</html>
using System;
namespace WebControlsApp
public partial class WebForm1 : [Link]
protected void Page_Load(object sender, EventArgs e)
protected void btnSubmit_Click(object sender, EventArgs e)
if ([Link])
string name = [Link];
string gender = [Link];
if ( && )
[Link] = $"Hello {name}! Gender selected: {gender}.";
else
[Link] = "Please fill all the fields.";
else
[Link] = "You must agree to the terms.";
}