Hi Firuz,
I have created sample that full fill your requirement.
HTML
<div>
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td>
<asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="OnChanged"
AutoPostBack="true">
<asp:ListItem>Select</asp:ListItem>
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
</asp:DropDownList>
</td>
<td>
<asp:DropDownList ID="DropDownList2" runat="server">
<asp:ListItem>Select</asp:ListItem>
<asp:ListItem>101</asp:ListItem>
<asp:ListItem>102</asp:ListItem>
<asp:ListItem>103</asp:ListItem>
<asp:ListItem>104</asp:ListItem>
<asp:ListItem>201</asp:ListItem>
<asp:ListItem>202</asp:ListItem>
<asp:ListItem>203</asp:ListItem>
<asp:ListItem>204</asp:ListItem>
<asp:ListItem>301</asp:ListItem>
<asp:ListItem>302</asp:ListItem>
<asp:ListItem>303</asp:ListItem>
<asp:ListItem>304</asp:ListItem>
<asp:ListItem>401</asp:ListItem>
<asp:ListItem>402</asp:ListItem>
<asp:ListItem>403</asp:ListItem>
<asp:ListItem>405</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
</div>
Code
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// Saving all the items from dropdown2 in session.
List<string> dropdown2Items = new List<string>();
foreach (ListItem item in DropDownList2.Items)
{
dropdown2Items.Add(item.Text);
}
Session["Items"] = dropdown2Items;
}
}
protected void OnChanged(object sender, EventArgs e)
{
string selectedItem = DropDownList1.SelectedItem.Text.Trim();
DropDownList2.Items.Clear();
List<string> filterItems = new List<string>();
foreach (string item in Session["Items"] as List<string>)
{
if (item[0].ToString() == selectedItem)
{
filterItems.Add(item);
}
}
DropDownList2.Items.Insert(0, new ListItem("Select"));
DropDownList2.AppendDataBoundItems = true;
DropDownList2.DataSource = filterItems;
DropDownList2.DataBind();
}
Screenshot