Ticket T336681
Visible to All Users
Duplicate

Web - How to remove confirmations message

created 9 years ago (modified 4 years ago)

I read this answer but it doesn't work for me

AutoRoll back doesn't seem to work in my case, I'm trying to remove the confirmation because I don't want this object to be saved no matter what, I managed to remove save, save and close, save and new buttons but I can't manage to remove the confirmation message. this object is supposed to be like a calculator and it shouldn't be saved, and it inherits persistent class so I can't just make it non persistent.

Visual Basic
Partial Public Class UnBindCalculationSheetController Inherits ViewController Public Sub New() InitializeComponent() End Sub Protected Overrides Sub OnActivated() MyBase.OnActivated() Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ModificationsController).SaveAction.Active.SetItemValue("Can't Save", False) Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ModificationsController).SaveAndNewAction.Active.SetItemValue("Can't Save", False) Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ModificationsController).SaveAndCloseAction.Active.SetItemValue("Can't Save", False) Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ModificationsController).ModificationsHandlingMode = ModificationsHandlingMode.AutoRollback End Sub

Answers approved by DevExpress Support

created 4 years ago

Hello,

If I understand it correctly, you are using an ASP.NET application. If so, to disable the confirmation dialog either set the global IModelActionWeb.ConfirmUnsavedChanges property:


or deactivate WebConfirmUnsavedChangesDetailViewController for a specific view as described here: How to: Deactivate (Hide) an Action in Code

For example:

C#
using DevExpress.ExpressApp; using DevExpress.ExpressApp.SystemModule; using DevExpress.ExpressApp.Web.SystemModule; using dxT336681.Module.BusinessObjects; namespace dxT336681.Module.Web.Controllers { public class CustomWebController : ObjectViewController<DetailView,Contact> { private const string myKey = "Can't Save"; protected override void OnActivated() { base.OnActivated(); Frame.GetController<ModificationsController>().SaveAction.Active.SetItemValue(myKey, false); Frame.GetController<ModificationsController>().SaveAndNewAction.Active.SetItemValue(myKey, false); Frame.GetController<ModificationsController>().SaveAndCloseAction.Active.SetItemValue(myKey, false); Frame.GetController<ModificationsController>().ModificationsHandlingMode = ModificationsHandlingMode.AutoRollback; changesController = Frame.GetController<WebConfirmUnsavedChangesDetailViewController>(); if(changesController != null) { changesController.Active[myKey] = false; } } WebConfirmUnsavedChangesDetailViewController changesController; protected override void OnDeactivated() { if(changesController != null) { changesController.Active.RemoveItem(myKey); } base.OnDeactivated(); } } }

Let me know whether these solutions meet your business needs.

Thanks,
Andrey

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.