protected void btnSaveNewADL_Click(object sender, EventArgs e) { foreach (DataListItem item in dlADLDetail.Items) { CheckBox chkSelect = (CheckBox)item.FindControl("chkSelect"); if (chkSelect.Checked && chkSelect.ToolTip == "0") //newly selected { ADLHeaderDetail aDLHeaderDetail = new ADLHeaderDetail(); aDLHeaderDetail.ADLDetailID = Int32.Parse(chkSelect.ValidationGroup); aDLHeaderDetail.ADLHeaderID = Int32.Parse(ddlADLHeader.SelectedValue); aDLHeaderDetail.ResidentID = Int32.Parse(Request.QueryString["ResidentID"]); aDLHeaderDetail.ExtraField1 = ""; aDLHeaderDetail.ExtraField2 = ""; aDLHeaderDetail.ExtraField3 = ""; aDLHeaderDetail.ExtraField4 = ""; aDLHeaderDetail.ExtraField5 = ""; int resutl = ADLHeaderDetailManager.InsertADLHeaderDetail(aDLHeaderDetail); } else if (!chkSelect.Checked && chkSelect.ToolTip != "0") //Need to delete { ADLHeaderDetailManager.DeleteADLHeaderDetail(int.Parse(chkSelect.ToolTip)); } } lblNewADLSaveMessage.Visible = true; lblNewADLSaveMessage.ForeColor = System.Drawing.Color.Green; loadADLDetailStatus(); loadGrid(); ddlADLHeader_SelectedIndexChanged(this, new EventArgs()); }
protected void btnAdd_Click(object sender, EventArgs e) { ADLHeaderDetail aDLHeaderDetail = new ADLHeaderDetail(); aDLHeaderDetail.ADLDetailID = Int32.Parse(ddlADLDetail.SelectedValue); aDLHeaderDetail.ADLHeaderID = Int32.Parse(ddlADLHeader.SelectedValue); aDLHeaderDetail.ResidentID = Int32.Parse(ddlResident.SelectedValue); aDLHeaderDetail.ExtraField1 = txtExtraField1.Text; aDLHeaderDetail.ExtraField2 = txtExtraField2.Text; aDLHeaderDetail.ExtraField3 = txtExtraField3.Text; aDLHeaderDetail.ExtraField4 = txtExtraField4.Text; aDLHeaderDetail.ExtraField5 = txtExtraField5.Text; int resutl = ADLHeaderDetailManager.InsertADLHeaderDetail(aDLHeaderDetail); Response.Redirect("AdminADLHeaderDetailDisplay.aspx"); }