Hi,Use the below code
This is simple eg by using the list.
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
List<string> namelist = new List<string>();
if (DropDownList1.SelectedIndex == 0)
{
namelist.Add("Abi");
namelist.Add("Anand");
namelist.Add("Arun");
GridView1.DataSource = namelist;
GridView1.DataBind();
}
else
{
List<string> nameslist = new List<string>();
nameslist.Add("Balu");
nameslist.Add("Banu");
nameslist.Add("Batman");
GridView1.DataSource = nameslist;
GridView1.DataBind();
}
}
.aspx
<asp:DropDownList ID="DropDownList1" runat="server"
onselectedindexchanged="DropDownList1_SelectedIndexChanged" AutoPostBack="true" >
<asp:ListItem>
a
</asp:ListItem>
<asp:ListItem>
b
</asp:ListItem>
</asp:DropDownList>
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>