Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

How to disable button based on grid selection?

Posted on by 920

Hi,

I have this form:

3007.security.png

I want when I select multiple rows the buttons disabled.

1.I modify property multiselection to No  => the buttons always enabled.

2. I add this code in the selectionChanged method of securityRole datasource  => the buttons always enabled.

3.Also I try to added it in the active method of securityRole datasource  => the buttons always enabled.

public void selectionChanged()
{
    int recordsCount;
    recordsCount =securityRole_ds.recordsMarked().lastIndex();
    info(strfmt("selection %1",recordsCount));
    if(recordsCount>1)
    {
        BtnNextUserRole.enabled(false);
    }
}

*This post is locked for comments

  • BASMA Profile Picture
    BASMA 920 on at
    RE: How to disable button based on grid selection?

    thanks, it works :)

  • Verified answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: How to disable button based on grid selection?

    If you add property MultiSelect: No to your button, it should do the trick. But only if you set the DataSource property of your ButtonGroup to link it to the same data source that you show on the grid.

    Otherwise the button group doesn't know anything about your selected records.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans