Page 1 of 1
Hide detail field in master detail add
Posted: Mon Apr 15, 2024 6:59 pm
by philmills
I'm trying to hide a field in the detail table when using Master/Detail add (URL MyMasterTableAdd?showdetail=MyDetailTable)
In Page_Render for list of the detail table I tried adding this:
if ($this->CurrentAction == "gridadd") {
$this->YourFieldName->Visible = false; // adjust YourFieldName to your actual field name
}
But it does nothing.
Any ideas?
v2023
Re: Hide detail field in master detail add
Posted: Mon Apr 15, 2024 7:49 pm
by mobhar
Try Page_Load server event instead.
In addition, make sure you have already adjusted YourFieldName
to your actual field name.
Re: Hide detail field in master detail add
Posted: Mon Apr 15, 2024 8:38 pm
by philmills
In detail table > List Page > Page_Load I have this
if($this->CurrentAction == "gridadd"){
$this->Cancel->Visible = FALSE;
$this->Notes->Visible = FALSE;
$this->Completed_Date->Visible = FALSE;
}
It still doesn't work...
Re: Hide detail field in master detail add
Posted: Mon Apr 15, 2024 11:03 pm
by mobhar
Make sure you have already re-generated ALL the script files, at least for the current master and detail table files.
Re: Hide detail field in master detail add
Posted: Tue Apr 16, 2024 9:30 am
by arbei
philmills wrote:
(URL MyMasterTableAdd?showdetail=MyDetailTable)
You are not in the Grid-Add mode of the List page (but in the Add page) of the master table, you may add your server event to the Add page of the master table or to the Detail Grid Page of the detail table.
Re: Hide detail field in master detail add
Posted: Wed Apr 17, 2024 9:41 am
by mobhar
The detail table is actually in gridadd mode for such case.
I tried Master/Detail Add with demo2024 project, for orders and orderdetails tables, with the URL ordersadd?showdetail=orderdetails
.
I put this code in Page_Load server event that belongs to the orderdetails table:
if ($this->CurrentAction == "gridadd") {
$this->Quantity->Visible = false;
}
and it works as expected. The Quantity field is hidden properly in detail table section of Master/Detail Add page.
If you want to test it quick, just add that code in the generated pageLoad server event that belongs to the models/OrderdetailsGrid.php file.
Re: Hide detail field in master detail add
Posted: Tue Apr 23, 2024 2:38 pm
by philmills