We have a dashboard that where users can print a packing slip. I have not created the code but i want to add to the code so when the epibutton (btnPrintPackSlip) is ticked it not just prints the packslip but will set a UD field to true.
{
// ** Place Event Handling Code Here **
//MessageBox.Show("btnPrintPackSlip_Click");
// Get a list of MtlQueue Sequence IDs and send to BPM method
string packNumList = "";
bool rowsSelected = false;
IEnumerable enumerator = this.myGrid.Rows.GetRowEnumerator(rowTypes, null, null);
foreach (UltraGridRow r in enumerator)
{
if(!r.IsGroupByRow && (bool)r.Cells["Calculated_RowSelect"].Value)
rowsSelected = true; //Set to true if any of the rows are selected
//if((bool)r.Cells["Calculated_RowSelect"].Value == true && r.Cells["ShipHead1_PackNum"].Value.ToString() != "")
if(!r.IsGroupByRow && (bool)r.Cells["Calculated_RowSelect"].Value == true && r.Cells["ShipHead1_PackNum"].Value.ToString() != "" && CanInclude(r, btnPrintPackSlip.Name))
{
if(packNumList == "")
packNumList += r.Cells["ShipHead1_PackNum"].Value.ToString();
else
{packNumList += ", "; packNumList += r.Cells["ShipHead1_PackNum"].Value.ToString();}
}
}
If go through the event wizard add custom code it throws the rest of the code out.
If this is a dashboard, do you really have an EpiDataView called “ShipHead”? It would have had to be added via code if so.
The short version is that if you want to set a field in the grid to true, you will need to know the EpiDataVIew name that is bound to the grid and set the CurrentDataRow (or the rows that how the “Calculated_RowSelect” set to true) field to true.
If you want to highlight a bunch of rows in the grid (by holding down Ctrl or Shift), then it becomes a little trickier as you will have to iterate through the grid and the set the values.
I would likely set the values at the grid level, but I’m sure I’m supposed to find the matching EpiDataVIew Row and update that instead.
You’ll probably need a customization on the dashboard. The dashboard has less functionality by itself, if you want to modify EpiDataViews you’ll need that customization.
Apologies, i was having a moment of not thinking what i’m trying to do.
My EpiDataView is called edvV_EPA_TCPreDelDtl_1View1. Ignore the extra coding i placed in regards to shiphead. I have added the ud field “ReprintBool_C” onto the BAQ and have pulled onto the dashboard. I am unsure where in the code i would place to update the current row when the epibutton is clicked and how i would write this.
The aim of this is when the boolean field is set to true i can then do a count in another ud field then reset that boolean field back to false. I can then pull this into the ssrs side to show when the count is over 1 display text showing this is a reprint.
i have figured out what i wanted to achieve on a different project i was working on. Belo w is the code on how to use an epi button to mark a ud field as true. The aim was to then have a bpm to load a report.
{
int cnt = myGrid.Rows.Count;
string msg = string.Format("There are '{0}' rows in the grid. Are you really realy REALLY sure you want to select ALL '{0}' rows? Click Yes to confrim, No to cancel", cnt);
// if (MessageBox.Show(msg, "Select all the jobs", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
{
ChangeAll(myGrid.Rows, true);
}
}
/* why is this it's own function? well it can handle selecting and unselecting and it can handle grouping within your grid */
public void ChangeAll(RowsCollection row, bool val)
{
foreach (UltraGridRow r in row)
{
if (r.GetType() == typeof(UltraGridGroupByRow))
ChangeAll(((UltraGridGroupByRow)r).Rows, val);
else
r.Cells["Customer_RemindLetter_c"].Value = val; /* change to whatever column you are updating for selection */
}
}