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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Conditionnally show or hide a checkbox from a grid

(1) ShareShare
ReportReport
Posted on by 17
Hello,
I need to conditionnally hide a checkbox (of type FormCheckBoxControl) that is embedded in a Grid (of type FormGridControl). This might be obvious to you but all of that is in a Form.
The checkb will hide or show based on the value of another fields of the Grid of the associated record.
 
I am looking at something where for each row of the grid if the value of my field is X then the checkbox will be hidden.
This could be done as the grid gets populated or after the fact, by going thru it.
 
The Grid is populated from a Datasource that is a Table.
 
What are the methods that I could use to get to the even and set the visibility.
 
Thanks for the help,
 
I have the same question (0)
  • GirishS Profile Picture
    27,833 Moderator on at
    Hi,
     
    Check box control will be enabled or disabled only if the user selects some records in the grid.
    Initially when you open the form, check box control will be shown, whenever the user selects any particular record, it will hide based on the X field value.
    For the above to work you need to write the code on DataSource active or selectionChanged method of the form grid DataSource. Same code you need to write on the modified method of the X field.
     
    Thanks,
    Girish S.
     
  • Martin Dráb Profile Picture
    238,789 Most Valuable Professional on at
    Hiding the column would lead to weird UX - you would move to another record, the column would disappear and subsequent columns would shift, and the column would be added again (and columns shifted) when moving to yet another record. A better approach will be changing AllowEdit to false.
     
     
  • Community member Profile Picture
    17 on at
    Thanks for your comments.
    To clarify, this is not the default checkbox that we are trying to hide / show but a custom one.
    We are not trying to hide the column or the cell. But the Checkbox itself. So the columns are not shifted.
    I assume that the allow edit to false will still show the chekcbox checked (event if it is not editable). What we are after if the show it unchecked of not visible at all.
     
     Here is a copy of the form we have.
     
     
    The value Etat can be OK or KO. The checkbox Forcé can be checked or not if etat is KO (base on what we have on the database).
    However, if the Etat is OK, we want to hide the checkbox (or show it unchecked) despite what the database indicate for the value.
     
    I hope that this will clarify my question.
     
    Thanks again.
  • Suggested answer
    Martin Dráb Profile Picture
    238,789 Most Valuable Professional on at
    A checkbox is a type of the column.
     
    Unchecked checkbox is the one that as its value set to No. Therefore if you want to show is unchecked, you want to set the value of the data source field to No, not to hide any control.
  • Suggested answer
    Komi Siabi Profile Picture
    13,190 Most Valuable Professional on at
    Salut, 
     
    The value Etat can be OK or KO. The checkbox Forcé can be checked or not if etat is KO (base on what we have on the database).
    However, if the Etat is OK, we want to hide the checkbox (or show it unchecked) despite what the database indicate for the value.
     
    With this requirement, Martin's advice is the best. You can make Forcé editable or not based based on the value of Etat.
     
    You could have a method called updateDesign().
     
     void updateDesign()
        {
            if(Etat.valueStr() == "OK")
            { 
               Forcé.allowEdit(false)
    
            else if(Etat.valueStr() == "KO")
            { 
               Forcé.allowEdit(false)
            }
       }
     call this method the active method of the datasourse like this:
    element.updateDesign()
     
     
    You might as well want control the field Forcé when a user edits Etat to "OK" or "KO". Hence, on the modified method of the field Forcé on the form, call the updateDesign() method.
    element.updateDesign()

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 512 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 386

#3
Adis Profile Picture

Adis 259 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans