DropDownListBox Demo
Design View
Source Code
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="[Link]"
Inherits="[Link]" %>
<!DOCTYPE html>
<html xmlns="h p://[Link]/1999/xhtml">
<head runat="server">
< tle></ tle>
<style>
body
{
background-image:url("images/[Link]");
background-size:cover;
}
#form1
{
height: 600px;
width: 500px;
background-color:aquamarine;
margin-le :auto;
margin-right:auto;
opacity:0.9;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="auto-style3">
<tr>
<td colspan="2" class="auto-style4" style="font-family: Arial; font-size: medium; font-weight:
bold">Addres Informa on</td>
</tr>
<tr>
<td class="auto-style5">
<asp:Label ID="Label1" runat="server" Text="City"></asp:Label>
</td>
<td class="auto-style1">
<asp:DropDownList ID="ddlcity" runat="server" Height="19px" Width="163px"
AutoPostBack="True" OnSelectedIndexChanged="ddlcity_SelectedIndexChanged">
<asp:ListItem>Kolhapur</asp:ListItem>
<asp:ListItem>Sangali</asp:ListItem>
<asp:ListItem>Satara</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="Taluka"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddltaluka" runat="server" Height="19px" Width="163px"
AutoPostBack="True"
OnSelectedIndexChanged="ddltaluka_SelectedIndexChanged"></asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label3" runat="server" Text="Village"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddlvillage" runat="server" Height="19px"
Width="163px"></asp:DropDownList>
</td>
</tr>
<tr>
<td colspan="2" >
<asp:Bu on ID="btnsubmit" runat="server" Text="Submit" OnClick="btnsubmit_Click" />
</td>
</tr>
<tr>
<td colspan="2">
<asp:ListBox ID="lstdisplay" runat="server" Height="80px" Width="317px"></asp:ListBox>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
Code -
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if ([Link] == "Kolhapur")
{
[Link]("Kagal");
[Link]("Radhanagari");
[Link]("Budhargard");
}
if ([Link] == "Sangali")
{
[Link]("Miraj");
[Link]("Tasgaon");
[Link](".....");
}
if ([Link] == "Satara")
{
[Link]("Karad");
[Link]("Maan");
[Link]("Budhargard");
}
}
}
protected void ddlcity_SelectedIndexChanged(object sender, EventArgs e)
{
[Link]();
if ([Link] == "Kolhapur")
{
[Link]("Kagal");
[Link]("Radhanagari");
[Link]("Budhargard");
}
if ([Link] == "Sangali")
{
[Link]("Miraj");
[Link]("Tasgaon");
[Link](".....");
}
if ([Link] == "Satara")
{
[Link]("Karad");
[Link]("Maan");
[Link]("Budhargard");
}
protected void ddltaluka_SelectedIndexChanged(object sender, EventArgs e)
{
[Link]();
if([Link]== "Kagal")
{
[Link]("Bidri");
[Link]("Borawade");
[Link]("Sonali");
}
if ([Link] == "Radhanagari")
{
[Link]("Titave");
[Link]("Turambe");
[Link]("Walava");
}
if ([Link] == "Budhargard")
{
[Link]("Mudal");
[Link]("Koor");
[Link]("Adamapur");
}
if ([Link] == "Miraj")
{
[Link]("Sangali");
[Link]("Peth");
[Link]("Kavathe");
}
}
protected void btnsubmit_Click(object sender, EventArgs e)
{
[Link]("Address Informa on");
[Link]("City : " + [Link]);
[Link]("Taluka : " + [Link]);
[Link]("Village: " + [Link]);
}