1

I have a smart panel, when i press OK button then panel close and reopen again. what am i doing wrng? Please find my popup panel OK C# and popup html below.

// Popup open code.
public PXAction<MyDAC> openPopup;
    [PXUIField(DisplayName = "Add", MapEnableRights = PXCacheRights.Select)]
    //[PXInsertButton]
    protected virtual IEnumerable OpenPopup(PXAdapter adapter) {
        
        if(CauseSmartPanel.AskExt() == WebDialogResult.OK) {
        }
        return adapter.Get();
    }

public PXAction<MyDAC> addEditOK;
        [PXUIField(DisplayName = "", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select, Visible = false)]
        public virtual IEnumerable AddEditOK(PXAdapter adapter) {
            
            return adapter.Get();
        }

<px:PXSmartPanel ID="pnlSmartCause" runat="server" CaptionVisible="True" Caption="My Smart Panel"
   Style="position: static" LoadOnDemand="True" Key="CauseSmartPanel" AutoCallBack-Target="frmMyCommand"
   AutoCallBack-Command="Refresh" DesignView="Content">
   <px:PXFormView ID="frmMyCommand" runat="server" SkinID="Transparent" DataMember="CauseSmartPanel" DataSourceID="ds" EmailingGraph="">
      <Template>
         <px:PXLayoutRule runat="server" StartRow="true" ControlSize="M" LabelsWidth="SM" StartColumn="True" />
         <px:PXSelector ID="edCauseId" CommitChanges="true" runat="server" AlreadyLocalized="False" DataField="CauseId" AutoRefresh="true">
         </px:PXSelector>
         <px:PXLayoutRule runat="server" StartRow="true" ControlSize="XM" LabelsWidth="SM" StartColumn="True" />
         <px:PXRichTextEdit ID="edDesc" runat="server" AlreadyLocalized="False" DataField="Description">
         </px:PXRichTextEdit>
         <px:PXLayoutRule runat="server" StartRow="true" StartColumn="True" ControlSize="SM" LabelsWidth="M"></px:PXLayoutRule>
         <px:PXSelector ID="edEditedBy" runat="server" AlreadyLocalized="False" DataField="EditedBy" AutoRefresh="true">
         </px:PXSelector>
         <px:PXPanel ID="PXPanel1" runat="server" SkinID="Buttons">
            <px:PXButton ID="btnMyCommandOK" CommandSourceID="ds" CommandName="AddEditOK"  SyncVisible="false" Text="OK" DialogResult="OK" runat="server"></px:PXButton>
            <px:PXButton ID="btnMyCommandCancel" runat="server" DialogResult="Cancel" Text="Cancel" />
         </px:PXPanel>
      </Template>
   </px:PXFormView>
</px:PXSmartPanel>
user_mat
  • 191
  • 2
  • 16

1 Answers1

0

No idea why your popup is loading a second time, but perhaps as a workaround, you could consider checking whether the user has already provided an answer to the popup. This is done by using the Answer property on the view. In your case, it might be something like this:

if (CauseSmartPanel.View.Answer == WebDialogResult.None)
{
    if(CauseSmartPanel.AskExt() == WebDialogResult.OK) {
    }
}

               
Joseph Caruana
  • 2,241
  • 3
  • 31
  • 48