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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to hide Control on Radio button Click

(0) ShareShare
ReportReport
Posted on by 1,010

Hello All,

I have added one control Radio Button in form with data type Enum. This enum contains two Elements:  Working days (enum value 1) and Calender Days ( enum value 2). On the radio button Click (enum 1) i want to hide group control and for enum value 2, I want to show group. for that i have override selectionchange( ) method and written following code.

public int selectionChange()
{
int ret;
if(radiobutton.selection(1))
{
DaysGroup.visible(false);
radiobutton.selection(2);
}
else if (radiobutton.selection(2))
{
DaysGroup.visible(true);
radiobutton.selection(1);
}
ret = super();

return ret;

}

Now, I am debugging and whenever i am changing radio button values from 1 to 2, the cursor is always going on only if(radiobutton.selection(1)) loop.

The same code i have written in Modified (override method) method of Radio button but still it is same.

 

*This post is locked for comments

  • Verified answer
    Anton Venter Profile Picture
    21,294 Super User 2026 Season 2 on at

    Hi, your code should be something like this:

    public int selectionChange()
    {
        int ret;
    
        if (radiobutton.selection() == 1) //put your enum value here instead of 1
        {
            DaysGroup.visible(false);
        }
        else if (radiobutton.selection() == 2) //and here instead of 2
        {
            DaysGroup.visible(true);
        }
    
        ret = super();
    
        return ret;
    }
  • Suggested answer
    5400 Profile Picture
    7,162 on at

    Please find the good practice to write this type of code

    Example:

    please write a one method as below in form method node and call it in required place.

    public void enabledControl()

    {

       if (RadioButton.selection() == NoYes::Yes)

       {

           Group1.visible(true);

       }

       else

       {

           Group1.visible(false);

       }

    }

    please call it init method() first for default or you can set default visable value in control.

    after that same method you can call in selectionChange() method.

    Thanks

    Bhaskar

  • D.K.S. Profile Picture
    1,010 on at

    Thanks Anton,.

  • Anton Venter Profile Picture
    21,294 Super User 2026 Season 2 on at

    You're welcome :)

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans