So I think I have exceeded my ignorance level on this.
I managed to get myself in to see the code for this example and and trying to apply it to epicor.
https://www.infragistics.com/community/forums/f/ultimate-ui-for-windows-forms/72048/ultra-grid-with-radio-buttons
Here is the code I am using for an example.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Infragistics.Win.UltraWinEditors;
namespace UltraGridWithRadioButtons96866
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.Load += new EventHandler(Form1_Load);
}
void Form1_Load(object sender, EventArgs e)
{
ultraGrid1.DataSource = GetData();
ultraGrid1.DataBind();
//Create a new instance of the UltraOptionSet
UltraOptionSet ultraOptionSet1 = new UltraOptionSet();
//Create the necessary ValueListItems to represent each of the desired options
Infragistics.Win.ValueListItem valueListItem1 = new Infragistics.Win.ValueListItem();
Infragistics.Win.ValueListItem valueListItem2 = new Infragistics.Win.ValueListItem();
Infragistics.Win.ValueListItem valueListItem3 = new Infragistics.Win.ValueListItem();
//Assign a data value for each option
valueListItem1.DataValue = "Yes";
valueListItem2.DataValue = "No";
valueListItem3.DataValue = "Not Sure";
//Assign the text which will be displayed within the UltraGrid for each option
valueListItem1.DisplayText = "Yes";
valueListItem2.DisplayText = "No";
valueListItem3.DisplayText = "Not Sure";
//Add each ValueListItem object to the items collection of the ultraOptionSet
ultraOptionSet1.Items.AddRange(new Infragistics.Win.ValueListItem[] {valueListItem1, valueListItem2, valueListItem3});
//Set the UltraOptionSet instance as the EditorComponent for the first column of the UltraGrid
ultraGrid1.DisplayLayout.Bands[0].Columns[0].EditorComponent = ultraOptionSet1;
//Resize the column to fit the presented options
ultraGrid1.DisplayLayout.PerformAutoResizeColumns(false, Infragistics.Win.UltraWinGrid.PerformAutoSizeType.VisibleRows);
}
//Create some sample data for the UltraGrid
private DataTable GetData()
{
DataTable dt = new DataTable();
dt.Columns.Add();
for (int i = 0; i < 9; i++)
{
dt.Rows.Add("item" + i.ToString());
}
return dt;
}
}
}
And this is what I managed to hobble together.
// **************************************************
// Custom code for UD08Form
// Created: 2/21/2018 10:56:33 AM
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Ice.BO;
using Ice.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
using Infragistics.Win.UltraWinEditors;
using Infragistics.Win;
public class Script
{
// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
// Begin Wizard Added Module Level Variables **
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
EpiUltraGrid MainGrid;
UltraOptionSet PackOption;
ValueListItem Pack;
ValueListItem Assemble;
ValueListItem None;
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
// End Wizard Added Custom Method Calls
MainGrid = (EpiUltraGrid)csm.GetNativeControlReference("7908565c-cc3c-43d1-b85b-9921ad88fb89");
}
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
MainGrid = (EpiUltraGrid)csm.GetNativeControlReference("7908565c-cc3c-43d1-b85b-9921ad88fb89");
}
private void UD08Form_Load(object sender, EventArgs args)
{
// Add Event Handler Code
// adding the option set, and the value list variables
UltraOptionSet PackOption = new UltraOptionSet();
ValueListItem Pack = new Infragistics.Win.ValueListItem();
ValueListItem Assemble = new Infragistics.Win.ValueListItem();
//assign the value for each option
Pack.DataValue = "P";
Assemble.DataValue = "A";
None.DataValue = "";
//Assign the text which will be displayed within the ultragrid for each option
Pack.DisplayText = "Pack";
Assemble.DisplayText = "Assy";
None.DisplayText = "None";
//add each ValueListItem object to the items collection fo the UltraOptionSet
PackOption.Items.AddRange(new Infragistics.Win.ValueListItem[] {Pack, Assemble, None});
//Set the UltraOptionSet instance as the EditorComponent for the Column of the UltraGrid
MainGrid.DisplayLayout.Bands[0].Columns[8].EditorComponent = MainGrid;
// Resize the column to fit the presented options
MainGrid.DisplayLayout.PerformAutoResizeColumns(false, Infragistics.Win.UltraWinGrid.PerformAutoSizeType.VisibleRows);
}
}
It compiles ok, but when I try to load it after saving, I get this error.
Application Error
Exception caught in: mscorlib
Error Detail
============
Message: Exception has been thrown by the target of an invocation.
Inner Exception Message: Object reference not set to an instance of an object.
Program: CommonLanguageRuntimeLibrary
Method: InvokeMethod
Client Stack Trace
==================
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Ice.Lib.Customization.CustomScriptMethodInvoker.InvokeScriptMethod(MethodInfo scriptMethod, Object[] parameters)
at Ice.Lib.Customization.CustomScriptMethodInvoker.InvokeCustomFormLoadIfExists(String methodName, Object sender, EventArgs e)
at Ice.Lib.Customization.CustomScriptManager.<>c__DisplayClass103_0.<OnCustomCodeFormLoad>b__0()
at Ice.Lib.Customization.CustomScriptManager.TryActionShowExceptionBoxOrLogVerificationErrorIfException(Action action, String exceptionBoxTitle)
Inner Exception
===============
Object reference not set to an instance of an object.
at Script.UD08Form_Load(Object sender, EventArgs args)
So now I am stuck. Some things that I am pretty sure that I am doing wrong.
-
I don’t know how I am supposed to bind my field (PackStatus_c) to the OptionSet. The example isn’t using a data source so I can’t copy what they have. I think there has to be something that binds the column and the field correct?
-
I’m assuming that the form load has to have something else after it right?. The sample has GetData(); but that doesn’t seem to work in this case.
So again, I apologize for my ignorance, you can laugh if you want, it probably won’t hurt my feelings. Unfortunately I think I’ve gone as far as I can get google to take me.