Hi All,
I have the following task (on EP). When user click the one of the MenuItem (let’s call it “createCSVFile” (on QuickLaunch menu), the appropriate class should be invoked, which is generating (on the server) csv file with some data. At the same time (on the same aspx page) after the “createCSVFile” is clicked, the standard browser’s feature (open or save – reference to the created file) should appear (thus the user will be able to open or download created file).
Based on some few tutorials (like: axforum.info/.../showthread.php ), I have faced with the following problem: when I click the “createCSVFile” MenuItem, the appropriate file is created, but the link (feature) doesn’t shows-up. Trying to investigate the problem, I have found, that in the following code, the WebPart_ActionMenuItemClicked method is not invoked, when I clicked the “createCSVFile” MenuItem (but I expected that it should).
using System;
using System.Collections; using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.Dynamics.Framework.Portal.UI.WebControls;
using Microsoft.Dynamics.Framework.Portal.UI.WebControls.WebParts;
using AppProxy = Microsoft.Dynamics.Portal.Application.Proxy;
using Microsoft.Dynamics.Framework.BusinessConnector.Session; using Microsoft.Dynamics.Framework.Portal.UI;
using Proxy = Microsoft.Dynamics.Framework.BusinessConnector.Proxy;//for test purpose (to be deleted) using Microsoft.Dynamics.AX.Framework.Services.Metadata.Contracts;
using Microsoft.Dynamics.AX.Framework.Services.Client;
public partial class OIT_DownloadFile3 : System.Web.UI.UserControl
{ ISession AxSession
{ get
{
AxBaseWebPart webpart = AxBaseWebPart.GetWebpart(this);
return webpart == null ? null : webpart.Session; } }
protected void Page_Load(object sender, EventArgs e)
{ ScriptManager scripts = ScriptManager.GetCurrent(this.Page);
if (scripts != null)
{ scripts.AsyncPostBackTimeout = 3 * 60; // in seconds }
AxBaseWebPart webpart = AxBaseWebPart.GetWebpart(this); }
protected void Page_Init(object sender, EventArgs e)
{ AxBaseWebPart webpart = AxBaseWebPart.GetWebpart(this);
webpart.ActionMenuItemClicked += new EventHandler(WebPart_ActionMenuItemClicked); }
protected void WebPart_ActionMenuItemClicked(object sender, ActionMenuItemEventArgs e)
{ string fileName = string.Empty if (e.MenuItem.MenuItemAOTName == "createCSVFile")
{ fileName = "FileNamePath"; }
if (!string.IsNullOrEmpty(fileName))
{AxUrlMenuItem getFileUrl = new AxUrlMenuItem("OIT_DownloadFile");
getFileUrl.ExtraParams.Add("file", "c:\\temp\\test.txt");
DialogHelper.Navigate(getFileUrl, this); } } }
I assume, that I miss something in markup part of the WebControl
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="OIT_DownloadFile3.ascx.cs" Inherits="OIT_DownloadFile3" %> <%@ Register Assembly="Microsoft.Dynamics.Framework.Portal.SharePoint, Version=6.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="Microsoft.Dynamics.Framework.Portal.SharePoint.UI.WebControls" TagPrefix="dynamics" %>
(I have nothing in ascx markup part of the WebControl, just the code above).
I was also trying to add this code: But I’ve got an error:
c:\Program Files\Common Files\microsoft shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\ep\OIT_DownloadFile3.ascx(6): error CS1061: 'ASP._layouts_ep_oit_downloadfile3_ascx' does not contain a definition for 'webPart_ActionMenuItemClicked' and no extension method 'webPart_ActionMenuItemClicked' accepting a first argument of type 'ASP._layouts_ep_oit_downloadfile3_ascx' could be found (are you missing a using directive or an assembly reference?)
Additionally: I have no DataSet for this webControl, that’s why I have no clue how to find the path of created file in this snippet fileName = "FileNamePath";
I was trying this one: fileName = AppProxy.OIT_VehStockRequestXls.main((AppProxy.OIT_ReportType.Distributor));
but it’s require something like this: e.DataSetRunArgs.parmEnumType = EnumMetadata.EnumNum(this.AxSession,"EPFormAction");
e.DataSetRunArgs.parmEnum(2);
(but as I told, I have no DataSet).
So generally, I would appreciate if someone can help me to find the answers on the following questions:
1. Why my WebPart_ActionMenuItemClicked method is not invoked, when I clicked the “createCSVFile” MenuItem? What to do in order to invoke it?
2. How to find out the path of the created file (for filename variable?
Thank you
*This post is locked for comments
I have the same question (0)

Report
All responses (
Answers (