protected void ICDChapterDropdownList_SelectedIndexChanged(object sender, EventArgs e)
    {
        // rebind data for the ICD drop down list
        var dl = (DropDownList)AddVisitFormView.FindControl("ICDDropdownList");

        dl.DataBind();
    }
 protected void ClearButton_Click(object sender, EventArgs e)
 {
     ((TemplateControls_DatePicker)AddVisitFormView.FindControl("DatePicker")).SelectedDate = DateTime.Now.Ticks;
     ((DropDownList)AddVisitFormView.FindControl("HospitalsDropdownList")).SelectedIndex    = 0;
     ((DropDownList)AddVisitFormView.FindControl("DoctorsDropdownList")).SelectedIndex      = 0;
     ((DropDownList)AddVisitFormView.FindControl("ICDChapterDropdownList")).SelectedIndex   = 0;
     ((DropDownList)AddVisitFormView.FindControl("OutcomeDropdownList")).SelectedIndex      = 0;
 }
    protected void AddVisitDataSource_Inserting(object sender, LinqDataSourceInsertEventArgs e)
    {
        // get the new visit to be inserted
        var newVisit = (Visit)e.NewObject;

        // get the value from the formview
        var icd       = ((DropDownList)AddVisitFormView.FindControl("ICDDropdownList")).SelectedValue;
        var date      = ((TemplateControls_DatePicker)AddVisitFormView.FindControl("DatePicker")).SelectedDate;
        var patientID = ((HiddenField)AddVisitFormView.FindControl("PatientIDField")).Value;

        // set the new value
        newVisit.ICDID     = long.Parse(icd);
        newVisit.Date      = date;
        newVisit.PatientID = long.Parse(patientID);
    }