Skip to main content
Solved

Display popup on RowSelected Event once


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!

Best answer by Dmitrii Naumov

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

View original
Did this topic help you find an answer to your question?

6 replies

Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+7
  • Acumatica Moderator
  • 632 replies
  • August 23, 2023

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


  • Author
  • 1 reply
  • August 24, 2023

@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?


Forum|alt.badge.img+9
  • Semi-Pro III
  • 229 replies
  • August 24, 2023

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
Acumatica Moderator
Forum|alt.badge.img+7
  • Acumatica Moderator
  • 632 replies
  • Answer
  • August 24, 2023

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


Zoltan Febert
Jr Varsity I
Forum|alt.badge.img+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.


@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.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings