Exemplo n.º 1
0
        private bool HandleUpdateCallback(int affectedRows, Exception ex) {
            GridViewUpdatedEventArgs sea = new GridViewUpdatedEventArgs(affectedRows, ex);
            sea.SetKeys(_updateKeys);
            sea.SetOldValues(_updateOldValues);
            sea.SetNewValues(_updateNewValues);

            OnRowUpdated(sea);
            _updateKeys = null;
            _updateOldValues = null;
            _updateNewValues = null;
            if (ex != null && !sea.ExceptionHandled) {
                // If there is no validator in the validation group that could make sense
                // of the error, return false to proceed with standard exception handling.
                // But if there is one, we want to let it display its error instead of throwing.
                if (PageIsValidAfterModelException()) {
                    return false;
                }
                sea.KeepInEditMode = true;
            }

            if (IsUsingModelBinders && !Page.ModelState.IsValid) {
                sea.KeepInEditMode = true;
            }

            // we need to databind here event if no records were affected because
            // changing the EditIndex required a rebind.  The event args give the programmer
            // the chance to cancel the bind so the edits aren't lost.
            if (!sea.KeepInEditMode) {
                EditIndex = -1;
                RequiresDataBinding = true;
            }
            return true;
        }
 private bool HandleUpdateCallback(int affectedRows, Exception ex)
 {
     GridViewUpdatedEventArgs e = new GridViewUpdatedEventArgs(affectedRows, ex);
     e.SetKeys(this._updateKeys);
     e.SetOldValues(this._updateOldValues);
     e.SetNewValues(this._updateNewValues);
     this.OnRowUpdated(e);
     this._updateKeys = null;
     this._updateOldValues = null;
     this._updateNewValues = null;
     if ((ex != null) && !e.ExceptionHandled)
     {
         if (this.PageIsValidAfterModelException())
         {
             return false;
         }
         e.KeepInEditMode = true;
     }
     if (!e.KeepInEditMode)
     {
         this.EditIndex = -1;
         base.RequiresDataBinding = true;
     }
     return true;
 }