Question

Updatable Dashboard - Act On Multiple Selected Rows

  • 15 September 2023
  • 1 reply
  • 133 views

Userlevel 2

2022.1.9, Classic WinForms screens, multi-company, multi-plant.

 

I’m building an updatable dashboard for the PartAlloc table, and I need to assign an entered value to a field in multiple rows depending on the user selection.  I’d like to make a customization with a field tied to a BPM data field (if that can be accessed from the C# code) and install an “Assign” button.  When the user clicks the button, the value in the box gets assigned to a field of all selected records in the grid.

My second choice would be to label one of the unused Y/N columns “select start” and another one “select end” and when the user clicks the button, assign the value to the field of all records between these two inclusive.   But it would be more intuitive for a Windows user who already knows how to select multiple rows of a grid, to be able to act on the selection.

Can someone advise me on the code to put in the click handler?

Thanks

..Monty.

Ps. Since my original posting I’ve come across someone attempting to do something similar, which was build a tilde-delimited list and pass it to a BO method.  I’ll post that code here.

private void btnBuildProjAnls_MouseClick(object sender,
System.Windows.Forms.MouseEventArgs args)
{
LaunchFormOptions opts = new LaunchFormOptions();
try
{
var dataRows = RRHeader.Selected.Rows;//RRHeader is the grid in question
string projectIDString = "";
foreach(Infragistics.Win.UltraWinGrid.UltraGridRow gridRow in dataRows)
{
projectIDString = projectIDString + "~" +
gridRow.Cells["ProjectCst_ProjectID"].Value.ToString();
} // end for each
opts.ValueIn = projectIDString.Substring(1); //Have to trim off the leading ~
ProcessCaller.LaunchForm(oTrans,"Erp.UIProc.GenerateAnalysis.dll",
opts);
} // end try
catch{}
} // end event handler

 


1 reply

Userlevel 2

The code turned out to be simple compared to the example code.  When the user clicks the Assign button, we just get the control reference to the grid, then use the dataRows code and foreach structure to set the first ten characters of the value into the grid field.

 

    private void btnAssign_Click(object sender, System.EventArgs args)

    {

        // ** Place Event Handling Code Here **

        try

        {

            string strPickerName = txtPickerEntry.Value.ToString(); // limit to first 10 chars

            if (strPickerName.Length > 10)

                strPickerName = strPickerName.Substring(0, 10);

            EpiUltraGrid myCustomGrid = (EpiUltraGrid)

                csm.GetNativeControlReference("c40a382f-b2ca-41b4-b0ae-53fdc6102428");

            var dataRows = myCustomGrid.Selected.Rows;//get the grid in question

            foreach(Infragistics.Win.UltraWinGrid.UltraGridRow gridRow in dataRows)

              {

              gridRow.Cells["PartAlloc_WaveDestBinNum"].Value = strPickerName;

              } // end for each

         } // end try

         catch{}

    } // end event handler

Reply