Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF ToolkitOne  /  How to hide/delete a Layout element based on condition

Forum Thread - How to hide/delete a Layout element based on condition

I have a dlex file with multiple columns. I want to hide a column based on certain condition.(if a property value is true)

I tried setting the width to "0" but no luck.

var qtrEle = layoutReport.GetElementById("RecordBox19") as RecordBox;
                 if (qtrEle != null)
                        qtrEle.Width = 0;

Is there any way to hide or delete an element from the documentlayout ?

Posted by a ceTe Software moderator
You can set the text color as of the background color of the PDF page using TextColor property of the RecordBox class object. This will not display the column contents which are associated with the specified layout element. Below is the code sample.

Please note that it is not possible to hide the column itself. Setting the text color to background color will hide the contents inside the column, but an empty column will be visible on the report.
          RecordBox recBox = (RecordBox)layoutReport.GetLayoutElementById("RecordBox2");
            if(recBox != null)
                recBox.TextColor = RgbColor.White;
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 10:42 PM.