In a formview, there are two dropdownlists - one for cities and one for states. Whenever the state dropdownlist is changed, the city dropdownlist gets updated using javascript. If the city dropdownlist remains unchanged via javascript, the values of dlCity.SelectedValue and testVar will be the same. However, if the city dropdownlist gets updated through javascript, the values of dlCity.SelectedValue and testVar will differ. The correct value is stored in testVar. I need to retrieve both the SelectedValue and SelectedItem.Text of the dropdownlist.
protected void fvEvent_ItemUpdating(object sender, FormViewUpdateEventArgs e)
{
DropDownList dlCity = fvEvent.FindControl("ddlVenueCity") as DropDownList;
e.NewValues["city"] = dlCity.SelectedItem.Text;
e.NewValues["cityID"] = dlCity.SelectedValue;
int testVar = Int32.Parse(Request.Form[dlCity.UniqueID]);
}