Hi kankon
Refer below sample code :
HTML
<div>Do you have Passport?
<asp:DropDownList ID="ddlHasPassport" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropDownList_Changed">
<asp:ListItem Text="Please Select" Value="0" />
<asp:ListItem Text="All" Value="1" />
<asp:ListItem Text="January" Value="2" />
<asp:ListItem Text="February" Value="3" />
<asp:ListItem Text="March" Value="4" />
<asp:ListItem Text="April" Value="5" />
</asp:DropDownList>
<hr />
<table>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<asp:Panel ID="pnlJan" runat="server" Visible="false">
<tr>
<th>January</th>
<th>$100</th>
</tr>
</asp:Panel>
<asp:Panel ID="pnlFeb" runat="server" Visible="false">
<tr>
<th>February</th>
<th>$280</th>
</tr>
</asp:Panel>
<asp:Panel ID="pnlMarch" runat="server" Visible="false">
<tr>
<th>March</th>
<th>$860</th>
</tr>
</asp:Panel>
<asp:Panel ID="pnlApril" runat="server" Visible="false">
<tr>
<th>April</th>
<th>$86</th>
</tr>
</asp:Panel>
</table>
</div>
C#
protected void DropDownList_Changed(object sender, EventArgs e)
{
if (ddlHasPassport.SelectedItem.Value == "1")
{
pnlJan.Visible = true;
pnlFeb.Visible = true;
pnlMarch.Visible = true;
pnlApril.Visible = true;
}
else
{
if (ddlHasPassport.SelectedItem.Value == "2")
{
pnlJan.Visible = true;
}
else
{
pnlJan.Visible = false;
}
if (ddlHasPassport.SelectedItem.Value == "3")
{
pnlFeb.Visible = true;
}
else
{
pnlFeb.Visible = false;
}
if (ddlHasPassport.SelectedItem.Value == "4")
{
pnlMarch.Visible = true;
}
else
{
pnlMarch.Visible = false;
}
if (ddlHasPassport.SelectedItem.Value == "5")
{
pnlApril.Visible = true;
}
else
{
pnlApril.Visible = false;
}
}
}
VB.Net
Protected Sub DropDownList_Changed(ByVal sender As Object, ByVal e As EventArgs)
If ddlHasPassport.SelectedItem.Value = "1" Then
pnlJan.Visible = True
pnlFeb.Visible = True
pnlMarch.Visible = True
pnlApril.Visible = True
Else
If ddlHasPassport.SelectedItem.Value = "2" Then
pnlJan.Visible = True
Else
pnlJan.Visible = False
End If
If ddlHasPassport.SelectedItem.Value = "3" Then
pnlFeb.Visible = True
Else
pnlFeb.Visible = False
End If
If ddlHasPassport.SelectedItem.Value = "4" Then
pnlMarch.Visible = True
Else
pnlMarch.Visible = False
End If
If ddlHasPassport.SelectedItem.Value = "5" Then
pnlApril.Visible = True
Else
pnlApril.Visible = False
End If
End If
End Sub
Screenshot