Changing An Epicor Grid Column From A Text Box To A Combo Box
By default when you add your UD fields in Epicor, if they are presented in a grid view they will be plain text input fields. What if you prefer to see them as combo boxes? There is a relatively easy fix, it might just not be entirely apparent. You end up creating the combo box (outside of the grid) exactly how you want it and then you use a quick bit of code to tell the grid to use that control instead of the default. Let’s jump into it:
Creating the combo box
As mentioned, we first need to create a combo box that behaves how we wish our grid column to behave. Perhaps it is a combo box that pulls it’s available values from User Codes as described here. The key is that for this particular control, we want the EpiBinding to be empty since it is merely being used as a template for how we want the grid column to operate. Ultimately when the task is all done you will want to hide this control in some manner (perhaps set the location to -1000, -1000). Note the name you have provided for the control as we will need it for the next section. In this example I have named it cmbMyUdColumn.
Apply the widget to the grid column
To apply the combo box to the grid column you will need to add a Form Load event and then use the following code to gain a reference to the grid (this part can be skipped if you are using a custom grid) and set the desired column to the control we created earlier:
// Define a reference to the grid EpiUltraGrid grdLines = (EpiUltraGrid)csm.GetNativeControlReference( "bec51417-b286-4d61-a471-3912bc098905" ); // Point the desired columns ValueList to the combo box created earlier grdLines.DisplayLayout.Bands[0].Columns["MyUDColumn_c"].ValueList = cmbMyUdColumn;