Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
45
Hidding child-parent relationship column in multi-band grid
posted

Hello,

I have a multi-band grid formed by two calsses, parent and child.

The parent class has a property which is a reference to the child, correctly showing up as a child band in the grid.

The child class has also a reference to the parent class, but with the browsable attribute set to false, this is successfully not shown neither as a column nor as a band. However, I'm getting a column called "Parent", which I'm assuming the grid is automatically inserting for me. This column doesn't even show in the columns collection, and of course the cell text only displays the name of the parent class. Curious enough, this column is also successfully using the [DisplayName] attribute defined in the Parent class.

Summing up:

[DisplayName("ParentDisplayName")
public class Parent 
{
    [Browsable(true)]
    IEnumerable<Child> Childs {get;}


public class Child
{

    [Browsable(false)]
    Parent Parent {get;}



The child band is displaying a column called "ParentDisplayName" which doesn't even show up in the Columns list for the band.

Any ideas on how to hide this column? Ideally without having to manually hide it like Columns("ParentDisplayName").Visible = false;

Thanks! 

Parents
  • 45
    posted

    I'm sorry, apparently the problem is precisely that the grid is not respecting the [Browsable(false)] attribute for any of the child band's properties. It does however respects the DisplayName attribute. 

    Any ideas? 

Reply Children