private void btnSave_Click(object sender, EventArgs e) { if (ValidateEntries()) { int intResults = 0; using (clsEmployeeDependent ed = new clsEmployeeDependent()) { ed.DependentCode = _strDependentCode; ed.Name = txtName.Text; ed.Birthdate = dtpBirthDate.Value; ed.Relation = txtRelation.Text; intResults = ed.Edit(); } if (intResults > 0) { switch (_FormCaller) { case FormCallers.EmployeeDetails: _frmEmployeeDetails.LoadDependentsList(); break; } Close(); } } }
protected void btnDependentSave_Click(object sender, EventArgs e) { foreach (DataGridItem itm in dgDependent.Items) { HiddenField phdnListDependentCode = (HiddenField)itm.FindControl("hdnListDependentCode"); TextBox ptxtListDependentName = (TextBox)itm.FindControl("txtListDependentName"); GMDatePicker pdtpListDependentBirthdate = (GMDatePicker)itm.FindControl("dtpListDependentBirthdate"); TextBox ptxtListDependentRelation = (TextBox)itm.FindControl("txtListDependentRelation"); clsEmployeeDependent ed = new clsEmployeeDependent(); ed.DependentCode = phdnListDependentCode.Value; ed.Name = ptxtListDependentName.Text; ed.Birthdate = pdtpListDependentBirthdate.Date; ed.Relation = ptxtListDependentRelation.Text; ed.Edit(); } BindDependentList(); }