Skip to main content

Notifications

Microsoft Dynamics NAV forum
Suggested answer

Visible in subpart with ControlAddin not working properly

Posted on by 286

Good morning all.

I have a page this page extension:

pageextension 7077200 "TCNItemListExtGDC" extends "Item List"
{
    layout
    {
        addlast(FactBoxes)
        {
            part(TCNDocsAdjuntosGDC; TCNFactBoxDocAdjGDC)
            {
                ApplicationArea = all;
                Caption = 'Documentos adjuntos';
                Visible = xGdvVisible;
            }
            part(TCNDropFicheroGDC; TCNDropFicherosCOM)
            {
                ApplicationArea = All;
                Visible = xGdvVisible;
            }
        }
    }

    trigger OnAfterGetCurrRecord()
    var
        culTCNFuncionesGDCCodeunit TCNFuncionesGDC;
    begin
        xGdvVisible := culTCNFuncionesGDC.Tabla2GdvF(Rec);
    end;

    var
        [InDataSet]
        xGdvVisibleBoolean;
}
The line: part(TCNDocsAdjuntosGDC; TCNFactBoxDocAdjGDC) wich is a "normal" listpart:
page 7077202 "TCNFactBoxDocAdjGDC"
{
    Caption = 'Documentos adjuntos';
    Editable = false;
    LinksAllowed = false;
    PageType = ListPart;
    ShowFilter = false;
    SourceTable = TCNDocsAdjuntadosGDC;
    UsageCategory = None;
    layout
    {
        area(content)
        {
            repeater(General)
            {
                field(DescripcionRec.Descripcion)
                {
                    ApplicationArea = All;
                    Caption = 'Descripción';
                    StyleExpr = xEstilo;
                }
                field(FicheroRec.Fichero)
                {
                    ApplicationArea = All;
                    Caption = 'Fichero';
                    DrillDown = true;
                    StyleExpr = xEstilo;
                    trigger OnDrillDown()
                    begin
                        AbrirFicheroF();
                    end;
                }
                field("Document Type"Rec."Document Type")
                {
                    ApplicationArea = All;
                    ToolTip = 'Specifies the value of the Document Type field.';
                }
                field("Due Date"Rec."Due Date")
                {
                    ToolTip = 'Specifies the value of the Due Date field.';
                    ApplicationArea = All;
                }
                field(UserAltaRec.UserAlta)
                {
                    ApplicationArea = All;
                    ToolTip = 'Especifica el usuario que ha creado el registro';
                }
                field(AltaRec.Alta)
                {
                    ApplicationArea = All;
                    ToolTip = 'Indica el momento (Fecha y hora) en la que se ha creado el registro';
                }
            }
        }
    }
I am able ro hide or show depending on the variable xGdvVisible in the page extension. Namely, it works as I want and as expected. 
But the second part:  part(TCNDropFicheroGDC; TCNDropFicherosCOM) wich instead of fields, has a control adding:
    Caption = 'Zona de carga de ficheros';
    PageType = CardPart;
    UsageCategory = None;
    layout
    {
        area(content)
        {
            usercontrol(PictureViewer; "Microsoft.Dynamics.Nav.Client.WebPageViewer")
            {
                ApplicationArea = all;
                Visible = not xOcultar;
                trigger ControlAddInReady(callbackUrl: Text)
                begin
                    CurrPage.PictureViewer.SetContent(PaginaHtmlF(xTextoDrop, xColor), ScriptF());
                end;

                trigger Callback(data: Text)
                begin
                    OnDropF(data, xDatosPasados);
                end;
            }
        }
    }
This one, does no hide/show with the same value as the first one, in the visible property. As you can see in the page extension, the variable  xGdvVisibleis declaerd as [InDataSet] in the list page.
I think wether it is a limitation in BC or a bug.
Could you please help me?
Thank you ever so much
  • JJMc Profile Picture
    JJMc 286 on at
    RE: Visible in subpart with ControlAddin not working properly

    Hi Yun.

    Firstly, I would like to thank you for your answer.

    Secondly,I tries what you say and it does not even woks:

    part(TCNDropFicheroGDC; TCNDropFicherosCOM)
    {
    ApplicationArea = All;
    Visible = false;
    }

    When opening the page, I can see the subpart

    Thank you again for your answer.

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 69,639 Super User 2024 Season 2 on at
    RE: Visible in subpart with ControlAddin not working properly

    Hi, I'm not sure if this can help you, according to my previous tests, the usercontrol part, even if it is hidden, will occupy a part of the page, although it does not display any value.
    You can directly modify Visible to false to try, I suspect the result will be the same.
    part(TCNDropFicheroGDC; TCNDropFicherosCOM)
    {
    ApplicationArea = All;
    Visible = false;
    }

    Hope this helps.

    Thanks.

    ZHU

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,524 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,493 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans