web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

treeview control in Enterprise portal

(0) ShareShare
ReportReport
Posted on by 1,330

Hi,

I want to create treeview control similar to shown in the below image.

It's a timesheet entry page where user selects Project and then Activity Dropdownlist opens as a treeview.

It shows all the activities related to the project selected.  Activities itself has parent child relationship and hence to be shown in tree view control.

I have gone through below link but it's different solution.

https://paruvellas.wordpress.com/2013/08/23/ax-2012-ep-lookup-as-tree-view-simple-example/

Any help would be appreciated. Thanks.

5153.treeview.jpg

*This post is locked for comments

I have the same question (0)
  • mail2vd Profile Picture
    1,330 on at

    just want to know if it's possible at all in EP or not?

  • Community Member Profile Picture
    on at

    Hi Iamv,

    Did you find a solution to this?

  • mail2vd Profile Picture
    1,330 on at

    we created a separate web page  to open it as a popup window. 

    In this popup window we used  <dynamics:AXhierarchicalGridView> control

    ---------------------------------------------------------------------------------------------

    <dynamics:AxHierarchicalGridView ID="AxHierarchicalGridView1" runat="server"
    BodyHeight="" DataKeyNames="RecId" DataMember="HierarchyTreeTable"
    DataSetCachingKey="de2bf1a9-e221-49d4-a9bd-c30e9ec66429"
    DataSourceID="DS_MyEPActivityTreeView" EnableModelValidation="True"
    HierarchyIdFieldName="ElementNumber"
    HierarchyParentIdFieldName="ParentElementNumber" ShowFilter="false"
    HierarchyTitleField="activityNumber**" Width="395px">
    <Columns>
    <dynamics:AxBoundField DataField="activityNumber**"
    DataSet="MyEPActivityTreeView" DataSetView="HierarchyTreeTable">
    </dynamics:AxBoundField>
    <dynamics:AxBoundField DataField="Name" DataSet="MyEPActivityTreeView"
    DataSetView="HierarchyTreeTable" SortExpression="Name">
    </dynamics:AxBoundField>
    </Columns>
    </dynamics:AxHierarchicalGridView>

    -------------------------------------------------------------------------------------------

    In the code behind of this control we are using below code.

    --------------------------------------------------------------------------------------------------------

    protected void Page_Init(object sender, EventArgs e)
    {
    // Determine whether the control is being used in a lookup.
    AxLookup lookupControl = AxLookup.GetLookup(this);
    if (lookupControl != null)
    {
    // It is a lookup, so set properties and register events.
    this.AxHierarchicalGridView1.ShowContextMenu = false;
    this.AxHierarchicalGridView1.ShowFilter = true;

    // Register the events to handle.
    lookupControl.OkClicked += new EventHandler<AxLookupEventArgs>(lookupControl_OkClicked);
    this.DS_MyEPActivityTreeView.CreatingDataSetRun += new EventHandler<CreatingDataSetRunEventArgs>(DS_MyEPActivityTreeView_CreatingDataSetRun);
    }
    }

    protected void DS_MyEPActivityTreeView_CreatingDataSetRun(object sender, CreatingDataSetRunEventArgs e)
    {
    e.DataSetRunArgs.parm = (string)Session["ProjId"];
    }

    protected void lookupControl_OkClicked(object sender, AxLookupEventArgs e)
    {
    // Get the current row in the data source used for the control.
    DataSetViewRow currentRow = this.DS_MyEPActivityTreeView.GetDataSourceView(this.AxHierarchicalGridView1.DataMember).DataSetView.GetCurrent();
    if (currentRow != null)
    {
    e.LookupControl.TargetITextControl.Text = (string)currentRow.GetFieldValue("activityNumber**");
    }
    }

    -------------------------------------------------------------------------------------------------------------------

    On the parent page we used <dynamics:AxBoundField> control for Activities

    ---------------------------------------------------------------

    <dynamics:AxBoundField DataSet="TSTimesheetEntry" DataSetView="TSTimesheetLine" HeaderText="<%$ AxLabel:@SYS54618 %>" SortExpression="ActivityNumber"
    DataField="activityTxt**" LookupButtonDisplaySettings="Always" AutoPostBack="True" ItemStyle-Width="11%">
    <ItemStyle Width="11%" />

    -----------------------------------------

    In code behind of the TSTimesheetEntry web page , we are just putting value of Project Id into Session variable which we are getting from the popup window. This is a drawback where ProjectId remains in the session for the lifetime of the user session. but we did not have any choice.

  • Community Member Profile Picture
    on at

    It's possible... my solution..

    treelookup.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans