Assume a DataGrid that, during edit mode, has two DropDownMenus, ddlA
and ddlB. Upon clicking 'Save,' the app performs the simplified task
of copying the DDL values of each to a label.
public void roleList_Update(Object sender, DataGridCommandEventArgs e)
{
// VARIABLES --------------
DropDownList ddlA = (DropDownList) e.Item.FindControl("ddlAEdit");
DropDownList ddlB = (DropDownList) e.Item.FindControl("ddlBEdit");
// ------------------------
Label1.Text = ddlA.SelectedValue + " " + ddlB.SelectedValue;
}
The output of Label1 will be 'X ', where X is the correct value from
ddlA -- ddlB's value is missing.
ddlB at least exists; were it not found, the app wouldn't operate at
all. Other quick checks confirm that the program recognises ddlB.
Despite this, it fails to see a SelectedItem there, while it reads the
same thing normally from its neighbour!
Thanks.