The
Listcompany
call needs to be within the
if (!Page.IsPostBack)
block. As it stands, you're re-binding the list every time it posts back, which means the
SelectedIndexChanged
event will never fire.
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Bind_CheckList();
Listcompany();
}
}
You should also give your controls meaningful IDs, instead of just accepting the default values provided by the Visual Studio designer. The IDs
ddl1
and
ddl3
tell you nothing about what these controls are used for.
It's particularly problematic when your IDs don't match your event handler names - who would be able to guess that
ddl1_SelectedIndexChanged
handles the
SelectedIndexChanged
event for
ddl3
? 🤦♂️