Home > Dynamics Ax, EP > Redirecting to the pages using Action Menu Items.

Redirecting to the pages using Action Menu Items.


In this example, want to illustrate, how we can use an Action Menu Item, to re-direct to the EP pages of Ax.

Have a look into the following picture.

Have placed the Image button, beside the Project Id.

On the click event of the Image button, calling Ax action menuitem and in the related action menu item class, redirecting to the details page by passing the required arguments.

The following code from the C# web part, click event of Image button.

protected void ImageButton_Click(object sender, EventArgs e)
{
 //The following lines for, to get the index of the selected row on the grid.
   ImageButton imageeButton = (ImageButton)sender;
   GridViewRow row = (GridViewRow)imageeButton.NamingContainer;
   AxGridViewTimesheet.SelectedIndex = row.DataItemIndex;      
   DataSetViewRow dsvr;
   //Creating object for Action menu item
   AxActionMenuItem projMenuItem = new AxActionMenuItem("PMProjTimesheetView");
   Proxy.Args args = new Proxy.Args(this.AxSession.AxaptaAdapter);
   //Get the current record
   dsvr = 
   this.AxDataSourceProjListTmp.GetDataSet().DataSetViews["ProjTable"].GetCurrent();
   IAxaptaRecordAdapter projTable = dsvr.GetRecord();
   
   //Passing the record to the action menu item class
   args.record = projTable;
   projMenuItem.Run(args);
}

The following code from the Ax action menu item related class (PMProjTimesheetView)

static void main(Args args)
{
    ProjTable           projTable;
    Weblink             link;
      ;
    if (args.dataset() == tablenum(ProjTable))
    {
        projTable = args.record();
        link = new Weblink();
        link.record(projTable);
        link.menufunction(new WebUrlMenuFunction(weburlitemstr(EPProjTableInfo)));
        webSession().redirect(link);
    }
}
Advertisements
Categories: Dynamics Ax, EP
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: