Not editable fields in Page

Hi

I would like to ask You one very begging question: 

How can I provide when I run some page from table/codeunit .. some fields (not all) to be Not Editable. I can't set property of that  Editable=False , because in different circumstances-> different fields should be not Editable. What function should be used after runing the page

 

                        ItemPage.SETTABLEVIEW(Item);

                        ItemPage.SETRECORD(Item);

                        ItemPage.RUNMODAL;

I tried with:    Page.Field.EDITTABLE(False), but it seems it is not possible use EDITABLE function only for filed or this is not right way for using it

Thanks in Advance

 

  • Here you've shown how you cause the Item Page to open, presumably from some menu item or other bit of code.  What you're trying to do is set the Editable property of one of the controls on the Item Page, and you'll most likely want to do that within the Item Page object.

    If you're trying to set the value of the field's Editable property based on a value within the record that the Page is displaying, then the best place to do that is in the OnAfterGetCurrentRecord trigger in the Item Page.  If you'll be setting the editable state of several fields at this point, you may want to make a function within Item Page to handle that, then just call the function from OnAfterGetCurrentRecord.

    When you've got the page open in Object Designer, you can open the C/AL Symbol Menu with F5, select currpage in the left-most column, Controls in the center column, then browse the controls listed in the right-most column to see which controls you can manipulate at runtime under the current definition of the Page.  You'll be able to see there what the syntax should be for setting the Editable property of the fields you want to work with.  Be sure, when you write this function, to always set a value for Editable for each field you're working with, to either true or false.  If you set the value to false on a certain condition, and then move to the next record, regardless of the value in that set of fields, the editable flag will still be false.  This is why you want to set the value to either true or false, so that each record has correctly set controls.

    In newer versions of NAV, you can also enter an expression as the source value of the Editable property for each field.  In that case, you wouldn't need the function, or the code in the OnAfterGetCurrentRecord.

    Play around with that a bit and see what you come up with.

     

  • In reply to George Love:

    Thanks 

  • In reply to Alen:

    currpage.Fieldname.EDITABLE(false);

    Does not works..... can we make fields on a page non editable. 

     

    Thanks in advance.....

Related