Skip to main content
Answer

What is the Equivalent of "Grid" control "RowDataBound" for "Form"

  • February 28, 2023
  • 5 replies
  • 137 views

aaghaei
Captain II
Forum|alt.badge.img+10

Hello Community,

In my “Page_Load” sometimes I use Grid Control RowDataBound to manipulate the grids layout as follows

PX.Web.UI.PXGrid gridWithStyle = (PX.Web.UI.PXGrid)ControlHelper.FindControl("grid", page);
if (gridWithStyle != null)
{
gridWithStyle.RowDataBound += (object grdsender, PXGridRowEventArgs erdb) =>
{
var grdRow = erdb.Row;

//Do Stuff
}
}

I have come across a situation where I need to do the same for “Form” control. I tried to replicate the same logic from Grid and modify it for Form but couldn’t make it work. This is what I have done but I have a problem with the commented part for “DataBound” as follows.

PX.Web.UI.PXFormView formWithStyle = (PX.Web.UI.PXFormView)ControlHelper.FindControl("form", page);
if (formWithStyle != null)
{
formWithStyle.DataBound += (object frmsender, EventArgs erdb) =>
{
// how? var frmRow = erdb.Row;

//Do Stuff
}
}

Any help is appreciated how can I make this work?

Best answer by aaghaei

Yes with some R&D I could make it work. I forgot to post the solution here.

 

PX.Web.UI.PXFormView formWithStyle = ControlHelper.FindControl("form", page) as PX.Web.UI.PXFormView;
if (formWithStyle != null)
{
formWithStyle.DataBound += (object frmsender, EventArgs erdb) =>
{
// Do stuff
};
}

 

5 replies

aaghaei
Captain II
Forum|alt.badge.img+10
  • Author
  • Captain II
  • March 1, 2023

@smarenich Can you please help?


smarenich
Acumatica Moderator
Forum|alt.badge.img+3
  • Acumatica Commerce Edition Team Lead
  • March 1, 2023

@aaghaei I personally tried to achieve what you want in the past, but I was not able to bypass certain challenges and problems. So unfortunately I have no way to do this properly for now.

In the future typescript-based UI this should be easier.


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • March 20, 2023

Hi @aaghaei  were you able to find a solution? Thank you!


aaghaei
Captain II
Forum|alt.badge.img+10
  • Author
  • Captain II
  • Answer
  • March 21, 2023

Yes with some R&D I could make it work. I forgot to post the solution here.

 

PX.Web.UI.PXFormView formWithStyle = ControlHelper.FindControl("form", page) as PX.Web.UI.PXFormView;
if (formWithStyle != null)
{
formWithStyle.DataBound += (object frmsender, EventArgs erdb) =>
{
// Do stuff
};
}

 


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • March 21, 2023

Thank you for sharing your solution with the community @aaghaei !