Zum Hauptinhalt gehen

Script report label to hide if image is included

Kommentare

3 Kommentare

  • Berend Veldkamp
    What's the source of the image? A URL, a local file on disk?
    0
  • Andrew Flynn
    The image is generated in a repeating sub-report from image attachments in a table of an esri feature service. The report created creates repeating records from the table, and displays the image attached to that record. What I would like to do is if there is no attached image the picture control is set to invisible, and a label that says "No Image Available" is set to visible. I hope that answers your question!
    0
  • Permanently deleted user
    Hi Andrew,

     

    To access the .Text property of a control that has text, you must cast the control to its native type.  The Controls[] array of a report section is an array of ARControl objects, which have only a few available properties (anything common to all controls, like position or visibility).  So your code will work if you cast to a TextBox like so:

     

    TextBox imgAttachment = (TextBox)rpt.Sections["detail"].Controls["imgAttachment"];

     

    string Image = imgAttachment.Text;

     

    You will have to stack the controls so that the "No Image Available" text appears once you remove the image, or you may want to toggle it on or off so that only one will appear.

     

    Regards,

     

    -Malcolm
    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.