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

 

posted @ Monday, July 6, 2009 4:26 AM
Print

Comments on this entry:

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

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

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

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

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

Left by Giocare al casino online at 12/2/2010 4:37 PM
Gravatar
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.

Your comment:



(not displayed)

 
 
 
 

Live Comment Preview:

 
«January»
SunMonTueWedThuFriSat
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456