protected void ICDChapterDropdownList_SelectedIndexChanged(object sender, EventArgs e) { // get the ICD drop down list var dl = (DropDownList)VisitDetailsFormView.FindControl("ICDDropdownList"); // rebind data for it dl.DataBind(); }
protected void VisitDetailsDataSource_Updating(object sender, LinqDataSourceUpdateEventArgs e) { var newObject = (Visit)e.NewObject; // get the ICD drop down list from the formview var dl = (DropDownList)VisitDetailsFormView.FindControl("ICDDropdownList"); // set the ICDID for the new object to be updated newObject.ICDID = long.Parse(dl.SelectedValue); // get the date picker from the formview var date = ((TemplateControls_DatePicker)VisitDetailsFormView.FindControl("DatePicker")).SelectedDate; // set the new date for the visit newObject.Date = date; }
protected void ICDDropdownList_DataBound(object sender, EventArgs e) { // get the linq data source of the ICD drop down list var dl = (DropDownList)VisitDetailsFormView.FindControl("ICDDropdownList"); // set the selected value of the ICD drop down list // dl.SelectedValue = ((Visit)VisitDetailsFormView.DataItem).ICDID.ToString(); if (VisitDetailsFormView.DataItem != null) { if (dl.Items.FindByValue(((Visit)VisitDetailsFormView.DataItem).ICDID.ToString()) == null) { // do nothing, leave the selected value by default } else { dl.Items.FindByValue(((Visit)VisitDetailsFormView.DataItem).ICDID.ToString()).Selected = true; } } }
protected void AddNewButton_Click(object sender, EventArgs e) { var patientID = ((HiddenField)VisitDetailsFormView.FindControl("PatientIDField")).Value; Response.Redirect("AddNewVisit.aspx?PatientID=" + patientID); }