I tried to hide a add button on a list page with de condition when there is a row, or when some column value have some info, just hide the add button, just that, I have the v2025.12
You may use ListOptions_Rendered server event.
I did it, i tried with $this->ListOptions->Items["add"]->clear();
But i got this error:
I tried with this $this->ListOptions["add"]->Body = "";
And I got this error:

How can I do it?
The error means Items["add"] is null.
Don't use that server event for the "add" option, you may use Page_Render server event instead and access the option by $this->OtherOptions["addedit"]["add"].
Thank you, I tried with this:
if ($this->TotalRecords > 0) {
if (isset($this->OtherOptions["addedit"]["add"])) {
$this->OtherOptions["addedit"]["add"]->Visible = false;
}
}
And it worked
