protected void AddNewMedicalServiceFormView_ItemInserting(object sender, FormViewInsertEventArgs e) { // set the MedicalServiceGroupID for the new object // get the control from the form view var dropdownList = (DropDownList)AddNewMedicalServiceFormView.FindControl("MedicalServiceGroupNameDropdownList"); // set the value e.Values["MedicalServiceGroupID"] = dropdownList.SelectedValue; }
protected void ClearForm() { ((TextBox)AddNewMedicalServiceFormView.FindControl("NameTextBox")).Text = ""; ((TextBox)AddNewMedicalServiceFormView.FindControl("PriceTextBox")).Text = ""; ((DropDownList)AddNewMedicalServiceFormView.FindControl("MedicalServiceGroupNameDropdownList")).SelectedIndex = 0; }