protected void FormViewGroup_ItemUpdating(object sender, FormViewUpdateEventArgs e) { TextBox txtGroup = (TextBox)formViewGroup.FindControl("txtGroup"); GroupActionStatus status = Validate(txtGroup.Text, actionType.update); if (status == GroupActionStatus.Success) { Type myType = (typeof(Group)); PropertyInfo[] props = myType.GetProperties(); string[] arrNewValues = new string[e.NewValues.Keys.Count]; e.NewValues.Keys.CopyTo(arrNewValues, 0); GroupBLL groupBLL = new GroupBLL(); Group group = groupBLL.GetGroupByGroupId2((int)e.Keys["GroupId"]); foreach (var prop in props) { if (("System.String,System.Int,System.DateTime,System.Guid").IndexOf((prop.PropertyType).FullName) >= 0) // Si la propiedad es de tipo Guid, String, Int o DateTime { if (!arrNewValues.Contains(prop.Name)) { e.NewValues[prop.Name] = prop.GetValue(group, null); } } } User editor = new UserBLL().GetUserByUserName((HttpContext.Current.User.Identity).Name); e.NewValues["EditorUserId"] = editor.UserID.ToString(); e.NewValues["EditedDate"] = DateTime.Now; } else { ltlMessage.Text = MessageFormatter.GetFormattedErrorMessage(GetErrorMessage(status)); e.Cancel = true; } }