I'm looking for a solution to get the first selected item in a DropDownList. And I want to get it when the page loads for the first time.
Thank you in advance.
Edit: I call this method at the Load-event but ddlNiveau2 remains empty. I think that ddlNiveau1.SelectedValue isn't accessed.
public void FillListNiveau2()
{
ddlNiveau2.Items.Clear();
foreach (var item in dBAL.GetListNiveau2(ddlNiveau1.SelectedValue))
{
ddlNiveau2.Items.Add(item.ToString());
}
RemoveDuplicateItems(ddlNiveau2);
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…