protected void PrescriptionDetailInfoFormView_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        // set the drug ID for the new object
        var drugID = long.Parse(((DropDownList)PrescriptionDetailInfoFormView.FindControl("DrugsDropdownList")).SelectedValue);

        e.NewValues["DrugID"] = drugID;
    }
    protected void DrugsDropdownList_DataBound(object sender, EventArgs e)
    {
        // get the drug dropdown list
        var dl = (DropDownList)PrescriptionDetailInfoFormView.FindControl("DrugsDropdownList");

        // set the selected value for the dropdown list
        var drugID = (new DataClassesDataContext()).PrescriptionDetails.Where(p => p.ID == long.Parse(Request.QueryString["ID"])).First().DrugID.ToString();

        if (dl.Items.FindByValue(drugID) == null)
        {
            // do nothing, leave the default selected value
        }
        else
        {
            dl.Items.FindByValue(drugID).Selected = true;
        }
    }