Page 1 of 1

Hide Edit option to record on list page base on condition

Posted: Sun Dec 04, 2022 7:41 am
by christ2000

Hello i am trying to figured out how hide the edit button on list page for certain records if a condition is true , the code i am using on Page Render event is:

    if ($this->approved->CurrentValue == 1) { 
    
    $this->OtherOptions["action"]->Items["edit"]->Visible = false;
}

but it is not working. any idea if there any solution for this?

thanks


Re: Hide Edit option to record on list page base on condition

Posted: Sun Dec 04, 2022 9:00 am
by mobhar

Edit button on List page is part of ListOptions object. It is not part of OtherOptions object.

In addition, you should use ListOptions_Rendered server event, not Page_Render.

So, your code should be:

if ($this->approved->CurrentValue == 1)
    $this->ListOptions["edit"]->Body = "";

Re: Hide Edit option to record on list page base on condition

Posted: Sun Dec 04, 2022 10:19 am
by christ2000

Perfect solution, thanks!!!