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)

How to pass a multiselection to the next page?

(0) ShareShare
ReportReport
Posted on by 2,550

I'm working on some enterprise portal modifications in AX 2012 and ran into the following issue:

I have a listpage with multiselect enabled. The selection made must be passed to the next page, which is opened by clicking a menu item on the actionpane. However, I don't know of any method to get the multiselection of the previous page. When I use an action menu item, I can get the multiselection from the Args parameter (args.multiselectioncontext()), but this parameter is not available when using a URL menuitem. I can get the currently selected record of the previous page, but that's only one record.

So the question is: when originating from a listpage, how do I get the multiselection from the grid of this listpage on the next page?

 

*This post is locked for comments

I have the same question (0)
  • Xander Vink Profile Picture
    2,550 on at

    Still haven't figured this one out. Any suggestions, ideas, ... ?

  • Community Member Profile Picture
    on at

    Hi Xander,

    I also faced the same problem and do you find any solutions on it?

  • Fred Xu Profile Picture
    85 on at

    Hi Xander,

    I have same problem on it.

  • Xander Vink Profile Picture
    2,550 on at

    No, sorry, haven't solved this one yet.

    I tried using an action menuitem that calls a class (that will receive the multiselection) to redirect to the next page. That also didn't work as that function call seems to be running in it's own worker thread and doesn't have access to the websession object. See also community.dynamics.com/.../130378.aspx

  • Community Member Profile Picture
    on at

    have you tried this?

    MultiSelectionHelper selection = MultiSelectionHelper::createFromCaller(_args.caller());

    MyTable myTable = selection.getFirst();

    while (myTable)

    {

       //do something

       myTable = selection.getNext();

    }

  • Xander Vink Profile Picture
    2,550 on at

    Yes, that works in the normal client or when calling a class with an action menuitem.

    It doesn't work in the EP when you link to a new page from a listpage...

  • Paresh Vajreenkar Profile Picture
    45 on at

    Hi Xander,

    I am also facing same issue. Did you get any solution on this?

    Thanks in advance.

  • Community Member Profile Picture
    on at

    Hello Xander,

    If you would want multi-selection in an AxGridView. Then you could use checkboxes to select multiple lines/records.

    Step 1: In the asp markup you insert a TemplateField in the AxGridView:

    <asp:TemplateField>

       <HeaderTemplate>

           <asp:LinkButton ID="btnAll" OnClick="btnAll_Click" Text="<%$ AxLabel:@SYS80094 %>" runat="server" />

           <asp:LinkButton ID="btnNone" OnClick="btnNone_Click" Text="<%$ AxLabel:@SYS38159 %>" runat="server" />

       </HeaderTemplate>

       <ItemTemplate>

           <table width="100%">

               <tr>

                   <td align="center"><asp:CheckBox ID="chkSelect" runat="server" /></td>

               </tr>

           </table>

       </ItemTemplate>

    </asp:TemplateField>

    Step 2: For the buttons created a ToggleCheck method in code-behind which loops over the rows in the AxGridView and checks the checkbox:

    protected void btnAll_Click(object sender, EventArgs e)
    {
        ToggleCheck(true);
    }
    protected void btnNone_Click(object sender, EventArgs e)
    {
        ToggleCheck(false);
    }
    protected void ToggleCheck(Boolean _checked)
    {
        foreach (GridViewRow row in gvBlogExample.Rows)
        {
            if (row.RowType == DataControlRowType.DataRow)
            {
                CheckBox chk = (CheckBox)row.FindControl("chkSelect");
                chk.Checked = _checked;
            }
        }
    }

    STEP 3: Now to know which lines were selected a method was created which loops over all the rows of the AxGridView and returns a Ax container with the selected RecId’s so you could pass the container through to an Ax method which handles processing:
    protected IAxaptaContainerAdapter getChecked()
    {
        IAxaptaContainerAdapter con = AxSession.AxaptaAdapter.CreateAxaptaContainer();
        foreach (GridViewRow row in gvBlogExample.Rows)
        {
            if (row.RowType == DataControlRowType.DataRow)
            {
                CheckBox chk = (CheckBox)row.FindControl("chkSelect");
                if (chk.Checked)
                {
                    DataSetView dsv = this.DSBlogExample.GetDataSourceView(this.gvBlogExample.DataMember).DataSetView;
                    dsv.SetCurrent(row.RowIndex);
                    string recid = dsv.GetCurrent().GetFieldValue("RecId").ToString();
     
                    con.Add(recid);
     
                }
            }
        }
        return con;
    Hope this helps to solve your problem.

    Regards,

    Mriganka

     

  • Community Member Profile Picture
    on at

    Also you can pass this container to another user control page designed in EP.

  • Xander Vink Profile Picture
    2,550 on at

    Thanks for your reply, but this isn't the solution to the problem.

    This would work when using a regular webpart, but I was talking about a listpage.

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