Are you using the Web ReportViewer for showing the report? If this is the case items with Visible=false are not rendered at all and as the HTML rendering extension is not a page oriented format, it would take up the space up automatically. This however goes only for vertical whitespace - horizontal whitespace would not be taken up automatically and this is by design.
A possible approach is making all
TextBoxes very short, i.e. decrease their height to almost zero, keep
the original spacing between them, and set their CanGrow property to
true. In this way when a TextBox has some data to show it will grow as
much as needed pushing all below it dows, and if it does not have any
data -- it will be invisible and it would not occupy a lot of space
because its height is minimal.
Second approach is to change the Textboxes' Size.Height and change their Location.Y properties appropriately, after you hide the unwanted items.
solution is to add the textboxes dynamically at runtime on the right
location and with appropriate size, based on the user input, instead of
creating all the columns at design time and then hide them.
If you have a report with Height reportHeight, and you have to display rowCount rows, then each row should look like reportHeight / rowCount wide, and the Location.Y of the textboxes should be
( reportHeight / rowCount ) * 0
( reportHeight / rowCount ) * 1
( reportHeight / rowCount ) * 2
( reportHeight / rowCount ) * (rowCount - 1)
Please, have in mind to make the items a little bit narrower, so that they do not overlap.
Give these approaches a try and see whether you can achieve the results
that you desire. If you exprience any problems or difficultities,
please send us your original report and we will advise what more can be done.
the Telerik team
Check out Telerik Trainer
, the state of the art learning tool for Telerik products.