protected void ClearButton_Click(object sender, EventArgs e) { ((DropDownList)AddPrescriptionDetailFormView.FindControl("DrugGroupsDropdownList")).SelectedIndex = 0; ((TextBox)AddPrescriptionDetailFormView.FindControl("QuantityTextBox")).Text = ""; ((TextBox)AddPrescriptionDetailFormView.FindControl("DoseTextBox")).Text = ""; ((TextBox)AddPrescriptionDetailFormView.FindControl("SpecialInstructionTextBox")).Text = ""; }
protected void AddPrescriptionDetailDataSource_Inserting(object sender, LinqDataSourceInsertEventArgs e) { // get the new object to be inserted var prescriptionDetail = (PrescriptionDetail)e.NewObject; // set the prescription ID property for it prescriptionDetail.PrescriptionID = long.Parse(Request.QueryString["PrescriptionID"]); // set the drug ID property for it var dl = (DropDownList)AddPrescriptionDetailFormView.FindControl("DrugsDropdownList"); prescriptionDetail.DrugID = long.Parse(dl.SelectedValue); }