protected void SaveInstitutionsGrid(object sender, CommandEventArgs e) { foreach (int dirtyRow in dirtyRows) { GridViewRow row = InstitutionGrid.Rows[dirtyRow]; TextBox instCon = (TextBox)row.FindControl("InstitutionName"); int priKey = int.Parse(((HiddenField)row.FindControl("InstitutionId")).Value); string newVal = instCon.Text; if (!string.IsNullOrEmpty(newVal)) { Institution biz = new Institution(); biz.Get(priKey); biz[Institution.Institution_Field] = newVal; biz[Institution.UpdatedTime] = DateTime.Now.ToString(); biz.Save(); } } dirtyRows.Clear(); AddPanel.Visible = false; }
protected void SaveInstitutionsGrid(object sender, CommandEventArgs e) { foreach (GridViewRow row in InstitutionGrid.DirtyGridRows) { ICaisisInputControl instCon = row.FindControl("InstitutionName") as ICaisisInputControl; object priKey = InstitutionGrid.DataKeys[row.RowIndex][BOL.Institution.InstitutionId]; string institutionName = instCon.Value; if (!string.IsNullOrEmpty(institutionName)) { Institution biz = new Institution(); // update if (!string.IsNullOrEmpty(priKey.ToString())) { biz.Get(int.Parse(priKey.ToString())); } biz[Institution.Institution_Field] = institutionName; biz.Save(); } } InstitutionGrid.DirtyRows.Clear(); RegisterUpdateScript(); }