Thursday, 13 June 2013

EP: C# Passing parametes from Modal dialog to calling page.

Parent page:

    protected void Page_Load(object sender, EventArgs e)
    {
       
        AxBaseWebPart.GetWebpart(this).ModalDialogClosed += new EventHandler(Base_ModalDialogClosed);
    }

///
    /// This method will  be used to Returning the value ModalDialogClosed.
    ///

    ///
    ///
    void Base_ModalDialogClosed(object sender, AXModalDialogClosedEventArgs e)
    {
        // Code to handle the returned value.
        string returnValue;
        returnValue = e.DialogArgs.Data;
        QtyEdit.Text = returnValue;
        try
        {
            if (returnValue != String.Empty && localRecId != String.Empty)
            {
                this.AvaOrderingListEntryDS.GetDataSet().DataSetRun.AxaptaObjectAdapter.Call("SalesLineQty", returnValue, localRecId);
            }
        }
        catch (Exception ex)
        {
            Proxy.Info objInfoLog = new Proxy.Info(this.AxSession.AxaptaAdapter);
            objInfoLog.add(Proxy.Exception.Info, "Ordering list not selected");
        }
    }

Child page:
on any button click:
protected void SaveButton_Click(object sender, EventArgs e)
    {
 AXDialogArgs args = DialogHelper.DialogArgs;
       args.Data = QtyEdit.Text;
       DialogHelper.Close(CloseDialogBehavior.Auto);
//can use the below to refresh calling page.
       //DialogHelper.Close(CloseDialogBehavior.RefreshPage);

    }

No comments:

How to Disable “Advanced Filter or Sort” and Enforce Custom Filters on Any D365FO Form

 In Dynamics 365 Finance and Operations, users can apply filters through the “Advanced filter or sort” feature found under the Options tab...