»»» technology + aesthetics «««

DAX 2009 Enterprise Portal Development : Using the Ax Session

Accessing the Session object

When adding code to User Controls for Enterprise Portal, many of the methods that you will use in the Enterprise Portal framework require access to the session object, for holding temporary values of the session, passing values between pages in Enterprise Portal.

Steps to access the session object

·         The Session object can be accessed through the AxWebPart hosting the AxUserControl.

·         The following namespaces have to be included in the User control to access the WebPart hosting the control and the Session object used by it.

using Microsoft.Dynamics.Framework.Portal.UI.WebControls.WebParts;

using Microsoft.Dynamics.Framework.BusinessConnector.Session;

·         The following accessor method can be added to the code to fetch the active Session object

AxBaseWebPart webPart;   

    protected AxBaseWebPart WebPart

    {

        get

        {

            if (webPart == null)

                webPart = AxBaseWebPart.GetWebpart(this);

 

            return webPart;

        }

    }

protected ISession AxSession

    {

        get

        {

            AxBaseWebPart webpart = this.WebPart;

            return webpart == null ? null : webpart.Session;

        }

    }

·         The getter method can be used as described in the following examples

1.    AxSession.AxaptaAdapter

2.    e.DataSetRunArgs.parmEnumType = EnumMetadata.EnumNum(this.AxSession, "name");

3.    AxSession.GetItemFromCache("name");

4.    AxSession.SetItemInCache("name", AxGridView1.SelectedDataKey.Value.ToString());

 

 References

·      http://msdn.microsoft.com/en-us/library/cc581944.aspx

 


  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Feedback

# re: DAX 2009 Enterprise Portal Development : Using the Ax Session

Hey, thanks for posting the detailed steps! 5/4/2010 9:27 PM | Combi Boiler Problems

# re: DAX 2009 Enterprise Portal Development : Using the Ax Session

This is exactly what i've been looking for! Thanks a lot. 11/2/2010 5:52 PM | Copper Repipe

# re: DAX 2009 Enterprise Portal Development : Using the Ax Session

thanks for sharing this.it is very informative.I am lookibg for this for a long time.This code is useful for my project.Plz give me some detail about session. 12/2/2010 4:37 PM | Giocare al casino online