This outline of your code works for me: both DropDownLists are AutoPostBack=true but not for the label.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace TestWeb
{
public partial class _Default : System.Web.UI.Page
{
string[] div = { "a", "b", "c", "d" };
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
GetData();
}
}
private void GetData()
{
foreach (var d in div)
{
this.ddlgroup.Items.Add(d);
}
}
protected void ddlgroup_SelectedIndexChanged(object sender, EventArgs e)
{
int index = this.ddlgroup.SelectedIndex;
FillNames(index);
this.ddlname.SelectedIndex = 0;
}
private void FillNames(int index)
{
if (index < 0 || index >= div.Length) return;
this.ddlname.Items.Clear();
for (int i = 0; i < 5; i++)
{
this.ddlname.Items.Add(div[index] + i.ToString());
}
}
protected void ddlname_SelectedIndexChanged(object sender, EventArgs e)
{
string name = this.ddlname.SelectedItem.Text;
this.lblOut.Text = "Selected Employee: " + name;
}
}
}