Is there any way to customize Acumatica’s pages .cs code inside the customization projects or VS? For starter I would like to get rid eye hurting red color of Approvals screen.
customizing Acumatica’s aspx.cs
Hi
![](https://uploads-us-west-2.insided.com/acumatica-en/attachment/a8dca031-6c93-4bcb-8205-5f59b34361ee.png)
Hi
https://www.acumatica.com/media/2020/09/AcumaticaERP_CustomizationGuide.pdf
Thanks
Hi
If you are creating a new screen, you can write the logic on the aspx.cs file. But the existing screen, I don't think we can customize the aspx.cs.
![](https://uploads-us-west-2.insided.com/acumatica-en/attachment/18fbdf2a-cdfe-4f8d-ae77-2002f4456aff.png)
To add color for a grid, please refer to the below links
Acumatica Visual Cues - How to colorize the grid in 2019 R1? - InfoSourcing Inc, Acumatica Partner - Washington DC, NY, FL (info-sourcing.com)
Using Colors in Acumatica - Acumatica Developers Blog .
Hi
Could you please let me know the business requirement?
Thanks
What I would like to do is showing different font colors based on the approval status of Approvals grid. I would like to show approved records in Green and Rejected ones in Red. In addition we have added custom status “Routed” that would like to show in Black or Blue. It helps easily see what are the different statuses by colore coding.
In addition I would like to take red color from Approvals screen which is shown for ALL records as aproval map consideres them as escalated.
Hi
I dig into deep and done some R&D and worked on it. I can able to provide the colors to the Grid lines for the existing screen i.e. Sales Order screen.
In this case, we no need to override the .aspx.cs file, we can still work on the SOOrderEntry Extended Graph to provide the colors based on the conditions, which I worked below.
I have attached code and screenshots for your reference.
![](https://uploads-us-west-2.insided.com/acumatica-en/attachment/e33ae210-dd40-4cc4-9c1e-3ce459e4f58a.png)
Sample Source Code
public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{
public override void Initialize()
{
Page page = HttpContext.Current?.Handler as PXPage;
if (page != null)
{
page.Load += Page_Load;
}
}
private void Page_Load(object sender, EventArgs e)
{
Page page = (Page)sender;
PXStyle rowStyle = new PXStyle();
rowStyle.BackColor = System.Drawing.Color.FromArgb(232, 252, 255);
page.Header.StyleSheet.CreateStyleRule(rowStyle, page, ".CssCurentRowStyle");
PXStyle rowStyleEditing = new PXStyle();
rowStyleEditing.BackColor = System.Drawing.Color.White;
page.Header.StyleSheet.CreateStyleRule(rowStyleEditing, page, ".CssCurentRowStyleEditing");
PXStyle cellStyleEditing = new PXStyle();
cellStyleEditing.BackColor = System.Drawing.Color.FromArgb(255, 255, 220);
page.Header.StyleSheet.CreateStyleRule(cellStyleEditing, page, ".CssCurentCellStyleEditing");
PXStyle cellStyleLastCost = new PXStyle();
cellStyleLastCost.BackColor = System.Drawing.Color.FromArgb(255, 217, 179);
page.Header.StyleSheet.CreateStyleRule(cellStyleLastCost, page, ".CssCurentCellStyleLastCost");
PXStyle cellStyleHeaderCurrent = new PXStyle();
cellStyleHeaderCurrent.BackColor = System.Drawing.Color.FromArgb(232, 252, 255);
page.Header.StyleSheet.CreateStyleRule(cellStyleHeaderCurrent, page, ".GridMain.Dash .GridRow.CssStyleHeaderCurrent");
PXStyle cellStyleHeaderPreview = new PXStyle();
cellStyleHeaderPreview.BackColor = System.Drawing.Color.FromArgb(255, 255, 220);
page.Header.StyleSheet.CreateStyleRule(cellStyleHeaderPreview, page, ".GridMain.Dash .GridRow.CssStyleHeaderPreview");
PX.Web.UI.PXGrid grdProfitBreakupByLine = (PX.Web.UI.PXGrid)ControlHelper.FindControl("grid", page);
if (grdProfitBreakupByLine != null)
{
grdProfitBreakupByLine.RowDataBound += (object grdsender, PXGridRowEventArgs erdb) =>
{
var data = erdb.Row.DataItem as PX.Objects.SO.SOLine;
if (data == null) { return; }
erdb.Row.Style.CssClass = data.CuryUnitPrice <= 0M ? "red20" : "black20";
};
}
}
}
Hope this helps for your requirement!!
Hi
#region Grid Style
public override void Initialize()
{
Page page = HttpContext.Current?.Handler as PXPage;
if (page != null)
{
page.Load += Page_Load;
}
}
private void Page_Load(object sender, EventArgs e)
{
Page page = (Page)sender;
//ForeColor
PXStyle foreColorGreen = new PXStyle();
foreColorGreen.ForeColor = System.Drawing.Color.Green;
page.Header.StyleSheet.CreateStyleRule(foreColorGreen, page, ".CssForeColorGreen");
PXStyle foreColorBlue = new PXStyle();
foreColorBlue.ForeColor = System.Drawing.Color.Blue;
page.Header.StyleSheet.CreateStyleRule(foreColorBlue, page, ".CssForeColorBlue");
PXStyle foreColorRed = new PXStyle();
foreColorRed.ForeColor = System.Drawing.Color.Red;
page.Header.StyleSheet.CreateStyleRule(foreColorRed, page, ".CssForeColorRed");
PX.Web.UI.PXGrid gridApprovalWithStyle = (PX.Web.UI.PXGrid)ControlHelper.FindControl("gridApproval", page);
if (gridApprovalWithStyle != null)
{
gridApprovalWithStyle.RowDataBound += (object grdsender, PXGridRowEventArgs erdb) =>
{
var data = erdb.Row.DataItem as PX.Objects.EP.EPApproval;
if (data == null) { return; }
if (data.Status == EPStatuses.Approved)
{
erdb.Row.Style.CssClass = "CssForeColorGreen";
}
else if (data.Status == EPStatuses.Rejected)
{
erdb.Row.Style.CssClass = "CssForeColorRed";
}
else if (data.Status == EPStatuses.Routed)
{
erdb.Row.Style.CssClass = "CssForeColorBlue";
}
};
}
#endregion
Those are all the CSS Styles I have added for some color coding, I think you can ignore all of those and have a code what is required.
Graph:
#region Grid Style
public override void Initialize()
{
Page page = HttpContext.Current?.Handler as PXPage;
if (page != null)
{
page.Load += Page_Load;
}
}
private void Page_Load(object sender, EventArgs e)
{
Page page = (Page)sender;
//ForeColor
PXStyle foreColorGreen = new PXStyle();
foreColorGreen.ForeColor = System.Drawing.Color.Green;
page.Header.StyleSheet.CreateStyleRule(foreColorGreen, page, ".CssForeColorGreen");
PXStyle foreColorBlue = new PXStyle();
foreColorBlue.ForeColor = System.Drawing.Color.Blue;
page.Header.StyleSheet.CreateStyleRule(foreColorBlue, page, ".CssForeColorBlue");
PXStyle foreColorRed = new PXStyle();
foreColorRed.ForeColor = System.Drawing.Color.Red;
page.Header.StyleSheet.CreateStyleRule(foreColorRed, page, ".CssForeColorRed");
PX.Web.UI.PXGrid approvalGridWithStyle = (PX.Web.UI.PXGrid)ControlHelper.FindControl("ApprovalGrid", page);
if (approvalGridWithStyle != null)
{
approvalGridWithStyle.RowDataBound += (object grdsender, PXGridRowEventArgs erdb) =>
{
var data = erdb.Row.DataItem as EPApproval;
if (data != null)
{
if (data.Status == EPStatuses.Approved)
{
erdb.Row.Style.CssClass = "CssForeColorGreen";
}
else if (data.Status == EPStatuses.Rejected)
{
erdb.Row.Style.CssClass = "CssForeColorRed";
}
else if (data.Status == EPStatuses.Routed)
{
erdb.Row.Style.CssClass = "CssForeColorBlue";
}
}
else
{
return;
}
};
}
PX.Web.UI.PXGrid approvalLogGridWithStyle = (PX.Web.UI.PXGrid)ControlHelper.FindControl("ApprovalLogGrid", page);
if (approvalLogGridWithStyle != null)
{
approvalLogGridWithStyle.RowDataBound += (object grdsender, PXGridRowEventArgs erdb) =>
{
var data = erdb.Row.DataItem as UDCTEPApprovalLog;
if (data != null)
{
if (data.Status == EPStatuses.Approved)
{
erdb.Row.Style.CssClass = "CssForeColorGreen";
}
else if (data.Status == EPStatuses.Rejected)
{
erdb.Row.Style.CssClass = "CssForeColorRed";
}
else if (data.Status == EPStatuses.Routed)
{
erdb.Row.Style.CssClass = "CssForeColorBlue";
}
}
else
{
return;
}
};
}
}
#endregion
and Page
<px:PXTabItem Text="Approvals" BindingContext="form" LoadOnDemand="True" RepaintOnDemand="True">
<Template>
<px:PXGrid runat="server" ID="ApprovalGrid" DataSourceID="ds" Width="100%" SkinID="DetailsInTab" NoteIndicator="True" Style="left: 0; top: 0;">
<AutoSize Enabled="True" />
<Mode AllowFormEdit="True" AllowRowSizing="True" AllowAddNew="False" AllowDelete="False" AllowUpdate="False" ></Mode>
<Levels>
<px:PXGridLevel DataMember="Approval">
<Columns>
<px:PXGridColumn DataField="ApprovedByID" Width="150px" />
<px:PXGridColumn Width="150px" DataField="ApproveDate" />
<px:PXGridColumn Width="80px" DataField="Status" AllowNull="False" AllowUpdate="False" RenderEditorText="True" />
<px:PXGridColumn DataField="Reason" Width="740" />
</Columns>
</px:PXGridLevel>
</Levels>
<Layout WrapText="True" />
</px:PXGrid>
</Template>
</px:PXTabItem>
<px:PXTabItem Text="Approvals Log" BindingContext="form" LoadOnDemand="True" RepaintOnDemand="True">
<Template>
<px:PXGrid runat="server" ID="ApprovalLogGrid" DataSourceID="ds" Width="100%" SkinID="DetailsInTab" NoteIndicator="True" Style='left: 0; top: 0;'>
<AutoSize Enabled="True" />
<Mode AllowAddNew="False" AllowUpdate="False" AllowDelete="False" AllowFormEdit="True" AllowRowSizing="True" />
<Levels>
<px:PXGridLevel DataMember="ApprovalLogView">
<Columns>
<px:PXGridColumn DataField="ApprovedByID" Width="150px" AllowNull="" AllowUpdate="" />
<px:PXGridColumn DataField="ApproveDate" Width="150px" SyncVisible="" />
<px:PXGridColumn DataField="Status" RenderEditorText="True" Width="80px" AllowNull="False" AllowUpdate="False" />
<px:PXGridColumn DataField="Reason" Width="740" />
</Columns>
</px:PXGridLevel>
</Levels>
<Layout WrapText="True" />
</px:PXGrid>
</Template>
</px:PXTabItem>
Hi
Have you debugged and able to get the values in the below object?
PX.Web.UI.PXGrid approvalGridWithStyle = (PX.Web.UI.PXGrid)ControlHelper.FindControl("ApprovalGrid", page);
Can you please move approvalLogGridWithStyle logic above then have code for approvalGridWithStyle and check colors are applying for only approvalGridWithStyle grid?
The funny thing is I’m doing the same on one of Acumatica’s other standard screens “Approvals” to color code different document types awaiting for approval and it works.
Hi
Also - if you want to change to size of an existing Popup form - you can add this code the the Graph Extension for that form
I was able to set the Popup size using a Graph Extension as follows:
using PX.Web.UI;
using System.Web;
using System.Web.UI;
public override void Initialize()
{
base.Initialize();
Page page = HttpContext.Current?.Handler as PXPage;
if (page != null)
{
page.Load += Page_Load;
}
}
private void Page_Load(object sender, EventArgs e)
{
Page page = (Page)sender;
//cant set the Popup height/width on the Master - as it is read only
// need to cast as BaseMasterPage
BaseMasterPage baseMasterPage = (BaseMasterPage)page.Master;
baseMasterPage.PopupHeight = 1000;
baseMasterPage.PopupWidth = 1800;
}
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.