Solved

Display popup on RowSelected Event once

  • 23 August 2023
  • 6 replies
  • 101 views

On the RowSelected Event, I am checking parameters and displaying a popup. The popup is working, but it displays the popup an endless number of times. I have tried adding a cookie when the dialog is displayed and required the cookie to not be there for the dialog to display again, but that does not seem to work.

var response = HttpContext.Current.Response;
if (!response.Cookies.AllKeys.Contains("mycookie")){
HttpCookie mycookie = new HttpCookie("mycookie");
response.Cookies.Remove("mycookie");
response.Cookies.Add(mycookie);

Base.Document.Ask("This is a TEST.", MessageButtons.OK);

return;
}

 

I am news to Acumatica Development, so any guidance or tips would be appreciated!

icon

Best answer by Dmitrii Naumov 24 August 2023, 14:23

View original

6 replies

@sodell 

If wanting a simple message PopupNoteManager is your friend :)

            PopupNoteManager.Message = "Access Denied.";
            PopupNoteManager.ShowMessageAfterRedirect();

If wanting to do something on the OK… then you are in the same boat as me :(

hope this helps a bit though.

Userlevel 6
Badge +3

@sodell What is your goal with this popup? If you give us some context maybe we can find a better way to approach it.

Userlevel 7
Badge +5

@sodell I’d go with just a warning /error message on a field instead of a popup

Userlevel 7
Badge +10

Hi @sodell ,

I'm not certain if this approach is correct, but it might be worth trying to see if it works for your situation.

private static bool _isPopupDisplayed = false;

public void YourDAC_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
YourDAC row = e.Row as YourDAC;
if (row == null) return;

if (!_isPopupDisplayed)
{
Base.Document.Ask("This is a TEST.", MessageButtons.OK);
_isPopupDisplayed = true;
}
}

 

Regards,

Sweta

@Dmitrii Naumov Thank you for your quick response!

Is there a better EventHandler you feel this could work with, or do you think it’s a lost cause?

Userlevel 7
Badge +5

I’d avoid such scenario overall. The system is not designed to show popups on rowSelected.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved