Options

Page Controls visibility while navigating between records

Ravi_Prakash_GoyalRavi_Prakash_Goyal Member Posts: 72
edited 2013-03-22 in NAV Three Tier
Hi,

I am working on NAV 2013 Page. I have some controls on document Page that I want to make visible/nonvisible based on some condition while navigating between records.

This is working in following scenario:
CASE-1
Open a Document Page where CheckBoxA = TRUE , then Control1 = Visible
Move to next record where CheckBoxA = FALSE, then Control1 = Non-Visible
Move to next record where CheckBoxA = TRUE, then Control1 = Visible

And not working in below scenario:
CASE-2
Open a Document Page where CheckBoxA = FALSE , then Control1 = Non-Visible
Move to next record where CheckBoxA = TRUE , then Control1 = Visible
Move to next record where CheckBoxA = FALSE, then Control1 = Non-Visible

where CheckBox is a field in a document record. and I set visible property for Control1 based on CheckBoxA value.

I am having issue in CASE-2. I figured out that when you open the document and controls are visible, then it is working. But when you open a document and controls are not visible, it does not make them visible again.

Should I assume that I can only alter visibility of controls that were rendered (visible) when you first open your page? Is there any workaround or is it a bug?

Answers

  • Options
    Ravi_Prakash_GoyalRavi_Prakash_Goyal Member Posts: 72
    I got it working finally. I figure out that you can change visibility of page controls on OnAfterGetCurrRecord() after rendering them in OnOpenPage() trigger.

    Earlier I was doing 2 errors:
    1) Made controls non-visible on OnOpenPage(). Due to this, controls never rendered on Page at run time, which is prerequisite (AFAIK) to manipulate visibility of control on some action on the page.

    2) Setting the control visibility on OnAfterGetRecord instead of OnAfterGetCurrRecord().

    So the correct method is
    - Set visiblilty of variable used for visible property to TRUE on OnOpenPage trigger
    - Change value of visibility variable on OnAfterGetCurrRecord() trigger

    Also, it is worth to mention that you cannot manipulate Page field visible property directly. You can achieve this by putting field control under Group container and change the visibility of Group container using a variable.

    Hope this helps.
Sign In or Register to comment.