Caller information in EP2009

If we want to get the caller page information in Enterprise portal 2009 which is similar to what we did in AX native client programming –

element.args().caller();

We can implement the following code in the user control:

using Microsoft.Dynamics.Framework.Portal;

private string GetElementCaller()

{

    string sPath = AxWebSession.GetPreviousURL(this.Page).ToString();

    string [] words = sPath.Split(‘/’, ‘?’);

    string caller = “”;

    foreach (string word in words)

    {

        if (word.Contains("aspx"))

        {

            caller = word;

            break;

        }

    }

    return caller;

}

Add a Label control on the ascx file with ID ‘Label1’ and put the following code in the Page_Load method

protected void Page_Load(object sender, EventArgs e)

{

   …

   if (!this.Page.IsPostBack)

   {

      this.Label1.Text = GetElementCaller();

   }

}

You will get the result like ‘EPProjTableInfo.aspx’. 

Advertisements
This entry was posted in Enterprise Portal. Bookmark the permalink.

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 )

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s