Surpress Text Box

3 posts, 0 answers
  1. Jeff P
    Jeff P avatar
    37 posts
    Member since:
    Mar 2007

    Posted 09 Sep 2008 Link to this post

    If a certain data field is blank, I want to surpress the caption text box and the data field text box to reclaim that space on the report.  Right now, I am using conditional formatting to hide the text boxes but blank spaces remain.

    Is thare any way to surpress those items so the data element under them will move up and use that space?
  2. Steve
    Steve avatar
    10941 posts

    Posted 09 Sep 2008 Link to this post

    Hi jalmto,

    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.
    Another 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.
  3. DevCraft R3 2016 release webinar banner
  4. Jeff P
    Jeff P avatar
    37 posts
    Member since:
    Mar 2007

    Posted 10 Sep 2008 Link to this post

    Thank you for the tips!

    I used the one whereas I make the text box height really small.  This works well since this only applies to a few items on the report.  It was easy and worked well!

    Thank you!
Back to Top