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:

Import and Export file from BLOB storage Account(Azure) in D365 F&O using X++

  Import and Export file from BLOB storage Account in D365 F&O using X++ Import: /// <summary> /// MKInventQualityOrderLineService...