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
4028
Hiding columns in child bands conditionally
posted

I have a multi-band UltraGrid in my winforms project. In one of the child bands, there is a column which I dont want to always see. Whether or not I want to see it is dependant on a field in the parent row.

So now I'm setting the column hidden/visible in the BeforeRowExpanded event of the ultragrid, as below:

        void ultraGrid_BeforeRowExpanded(object sender, CancelableRowEventArgs e)

        {

            Item item = e.Row.ListObject as Item;

            if (item.SingleColour)

            {

                e.Row.ChildBands[constColourBand].Band.Columns["UnitCost"].Hidden = true;

                e.Row.ChildBands[constColourBand].Band.Columns["UnitCost"].ExcludeFromColumnChooser = ExcludeFromColumnChooser.True;

            }

            else

            {

                e.Row.ChildBands[constColourBand].Band.Columns["UnitCost"].Hidden = false;

                e.Row.ChildBands[constColourBand].Band.Columns["UnitCost"].ExcludeFromColumnChooser = ExcludeFromColumnChooser.False;

 

            }

        }

 The problem is, this code changes the column hidden property for *all* bands - that is, the child bands (of this type) within other parent rows. Obviously this is not what I want - I only want to set this property for the child band being expanded, not the child bands for other rows.

How can I acheive what I want here? How do I prevent it from hiding the columns in the child bands of other rows?

Thanks. 

 

Parents Reply Children
No Data