if(e.Item.ItemType == ListItemType.EditItem)
{
//how to find the current value that is in the database and use that
//as the way to preselect the appropriate item from the dropdownlist
//
http://msdn.microsoft.com/library/d...QuestionsAboutASPNETDataGridServerControl.asp
DataRowView drvCity = (DataRowView) e.Item.DataItem;
String CurrentCity = drvCity["city_code"].ToString(); //city_code is
the database column
DropDownList ddlCity = (DropDownList)
e.Item.FindControl("ddl_edit_cities");
ddlCity.SelectedIndex =
ddlCity.Items.IndexOf(ddlCity.Items.FindByText(CurrentCity));
DataRowView drvEdit = (DataRowView) e.Item.DataItem;
String CurrentIndicator = drvEdit["indicator"].ToString();
DropDownList ddlEdit = (DropDownList)
e.Item.FindControl("ddl_edit_indicator");
ddlEdit.SelectedIndex =
ddlEdit.Items.IndexOf(ddlEdit.Items.FindByValue(CurrentIndicator));
//notice this last one is FindByValue because the values in the
listitems
//are different than than the text displayed to the user