private void btnSave_Click(object sender, EventArgs e) { if (IsCorrectEntries()) { int intResults = 0; clsEmployeeResearch er = new clsEmployeeResearch(); er.ResearchCode = _strResearchCode; er.Title = txtTitle.Text; er.DateCompleted = txtDateCompleted.Text; er.Remarks = txtRemarks.Text; intResults = er.Edit(); if (intResults > 0) { _frmEmployeeDetails.LoadResearchList(); this.Close(); } } }
protected void btnSave_Click(object sender, EventArgs e) { foreach (DataGridItem itm in dgResearch.Items) { HiddenField phdnReseCode = (HiddenField)itm.FindControl("hdnReseCode"); TextBox ptxtTitle = (TextBox)itm.FindControl("txtTitle"); TextBox ptxtDateCompleted = (TextBox)itm.FindControl("txtDateCompleted"); TextBox ptxtDetails = (TextBox)itm.FindControl("txtRemarks"); clsEmployeeResearch er = new clsEmployeeResearch(); er.ResearchCode = phdnReseCode.Value; er.Title = (ptxtTitle.Text.Length > 100 ? ptxtTitle.Text.Substring(0, 100) : ptxtTitle.Text); er.DateCompleted = (ptxtDateCompleted.Text.Length > 50 ? ptxtDateCompleted.Text.Substring(0, 50) : ptxtDateCompleted.Text); er.Remarks = (ptxtDetails.Text.Length > 255 ? ptxtDetails.Text.Substring(0, 255) : ptxtDetails.Text); er.Edit(); } BindResearchList(); }