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)

Grid Cell Color

(0) ShareShare
ReportReport
Posted on by

Hi everyone,

I am using dynamics ax 2012 and new to development. I want to colorize the grid cells based on its value.  So same row may contains cells with different color. For this, i am overriding displayoptions() of Data source.  But i realized that  only the last set color is affecting the entire cells in a row. How can i achieve this.

As an another example i am using the following code to colorize different columns

public void displayOption(Common _record, FormRowDisplayOption _options)

{

   _options.backColor(WinApi::RGB2int(255,0,0));

   _options.affectedElementsByControl(FIELD_1.id());

    _options.backColor(WinApi::RGB2int(0,0,255));

    _options.affectedElementsByControl(FIELD_2.id());

Here i am expecting red color for FIELD_1 and blue color for FIELD_2.  But i am getting both the columns with blue color.

please suggest the code for achieving the desired result

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    300,911 Super User 2025 Season 2 on at

    Hi No Man,

    Per record you can have only one back color. It is not per control.

    The affectedElementsByControl is only for specifying which contols needs to have the background color if you don't want to have all controls marked with the background..

  • Community Member Profile Picture
    on at

    Hi  Andrea,

    Per record only one back color means I cannot specify cell wise coloring based on cell value. My grid has  many columns having cell values like  L, S,P, A etc.  I  need to mark each cell value with different color.  In that case one row may affected by different colours.  ( example in row 1  Col A value - L, Col B value - P ...).  So is there any solution in such a situation.

  • Suggested answer
    PA-22040759-0 Profile Picture
    6,194 on at

    I have had a similar requirement from a customer, and it won't work with the grid control.

    I ended up solving this using the FormTableControl. In the AOT there is a tutorial form for this control.

    But it will give you a lot more work to do to present the data.

  • André Arnaud de Calavon Profile Picture
    300,911 Super User 2025 Season 2 on at

    Hi No man, Palle,

    I was about writing about the FormTable control. This indeed can have a color per cell, but you have to manually fill the cells. Be careful with much records in this control.

  • PA-22040759-0 Profile Picture
    6,194 on at

    I must admit that with fifteen years of experience with AX, I only this one time found it relevant to use the FormTableControl for anything :-)

  • André Arnaud de Calavon Profile Picture
    300,911 Super User 2025 Season 2 on at

    We had once a challenge where we could not even use this FormTableControl. We ended up in placing controls dynamically on the form and use a vertical scrollbar to show records that did not fit on the form.

    Was years back with AX3.0.

  • Community Member Profile Picture
    on at

    Thanks Andre, palle..

    It would be helpful if you could provide me something useful tutorial about FormTableControl that suits my requirement.

  • Verified answer
    PA-22040759-0 Profile Picture
    6,194 on at

    Please have a look at the Tutorial_Form_Table form, which you can find in the AOT.

    And here is a link to the MSDN documentation: msdn.microsoft.com/.../formtablecontrol.aspx

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