How to Get Dropdown in grid to update programmatically

//using System.IO;

using(MemoryStream layout = new MemoryStream())
{
	epiUltraGridC1.DisplayLayout.Save(layout, Infragistics.Win.UltraWinGrid.PropertyCategories.All);

	var ds = epiUltraGridC1.DataSource;
		
	epiUltraGridC1.DataSource = "";

	epiUltraGridC1.Refresh();
	
	epiUltraGridC1.DataSource = ds;
		
	epiUltraGridC1.Refresh();

	layout.Seek(0, SeekOrigin.Begin);

	epiUltraGridC1.DisplayLayout.Load(layout);
}

Maybe move that last grid refresh to the end, or may can omit it.

If you can find the combobox you can call

myCombo.ForceRerfreshList();

It might be a little tricky to get a hold of the combobox from the grid but it isn’t impossible. I do not recommend un-binding that grid and re-binding it.

There’s still something off about this… it works but now it doesn’t show the description of the warehouse. It shows the code only. I’m sure I am overlooking something silly.

Did yo try doing a notify here inside the loop for each of the rows?

edvMtl.Notify(new EpiNotifyArgs(oTrans,i,EpiTransaction.NotifyType.Initialize))

Yes, I just re-tried it to make sure but yeah same effect. I’ve also tried oTrans.NotifyAll() and I’ve also tried it outside of that for loop.

I also created a comboBox and binded it to the Mtl.Warehouse field. It updates just great… haha. But not the grid column.

Try something like this.

EpiCombo ec = (EpiCombo)thatGrid.DisplayLayout.Bands[0].Columns["TheFieldName"].ValueList;

ec.ForceRefreshList();

Edit: I don’t know if it’s an EpiCombo, I’m just guessing.

If you can’t figure out the control type you could try runtime binding:

dynamic ec = thatGrid.DisplayLayout.Bands[0].Columns["TheFieldName"].ValueList;

ec.ForceRefreshList();

Yeah it doesn’t like that. IValueList != EpiCombo.
I’ll keep digging in the Object Explorer. There’s got to be something in there I can use.

Thanks for all your help!!

For what it’s worth, there is a Detail tab also that loads the currently selected row from the grid. It also seems to update correctly haha. Just not the grid.

did you try it with dynamic?

You could throw a try catch around assigning it to something it’s not and
display the error message in a messagebox.

You made me open it up.

It’s an EpiUltraCombo.

I added your code to a customization on it and got the same error.

This fixed it:

		for (int i = 0; i < edvMtl.dataView.Count; i++)
		{
			edvMtl.dataView[i].BeginEdit();
			edvMtl.dataView[i]["Warehouse"] = warehouse;
			edvMtl.dataView[i]["Ware"] = bin;
			edvMtl.dataView[i]["RowMod"] = "U";
			edvMtl.dataView[i].EndEdit();
		}
		oTrans.NotifyAll();

		EpiUltraCombo ec = (EpiUltraCombo)mtlGrid.DisplayLayout.Bands[0].Columns["Warehouse"].ValueList;
		ec.ForceRefreshList();			

@josecgomez :heart:

2 Likes

I’d like to thank @josecgomez for this award. :rofl: