コード例 #1
0
        private bool HandleDeleteCallback(int affectedRows, Exception ex) {
            ListViewDeletedEventArgs e = new ListViewDeletedEventArgs(affectedRows, ex);
            e.SetKeys(_deleteKeys);
            e.SetValues(_deleteValues);

            OnItemDeleted(e);
            _deleteKeys = null;
            _deleteValues = null;

            if (ex != null && !e.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;
                }
            }
            EditIndex = -1;

            if (affectedRows > 0) {
                // Patch up the selected index if we deleted the last item on the last page.
                if ((_totalRowCount > 0) &&
                    (_deletedItemIndex == SelectedIndex) &&
                    (_deletedItemIndex + _startRowIndex == _totalRowCount)) {
                    SelectedIndex--;
                }
            }
            _deletedItemIndex = -1;

            RequiresDataBinding = true;
            return true;
        }