I have a table "tbl_credit_memos" to store credit memo detial. The credit_memos table has among other, a field for 'CustomerNo' and a field for "InvoiceNo".
tbl_credit_memos is displayed in a wingrid call ug_Main.
I have a dropdown (udd_CustomerNo) that is bound to the CustomerNo column in ug_Main(both the value and display properties are "CustomerNo"). udd_CusomterNo is populated by information from a table called tbl_Customers.
I also have a dropdown (udd_InvoiceNo) that is bound to the InvoiceNo column in ug_Main(both the value and display properties are "InvoiceNo"). udd_InvoiceNo is populated by information from a table called tbl_Invoices.
The above works fine, however, I need the invoice dropdown(udd_invoiceNo) to only display those invoices that are for the CustomerNo selected in the udd_CustomerNo drop down. Any help would be greatly appreciated.
I am using VS2010(visual basic), windows forms, and 10.3 Win CLR2x. Thanks.
Creating a dropdown list in a grid cell whose list values are dependent on another cell - Windows Forms - Infragistics Community
Mike - Thank you for the link. Looks fairly straight forward but I cannot quite figure out the correct vb 2010/10.3 Win form syntax for the following:
UltraGridBand rootBand = this.citiesDropDown.DisplayLayout.Bands[0];
rootBand.ColumnFilters.ClearAllFilters();
rootBand.ColumnFilters["StateID"].FilterConditions.Add
if you could point me in the right direction i would appreciate it(if this was a really stupid question, I apologize in advance :)
Thanks
found a solution..loop. :/
private void gridData_AfterCellUpdate(object sender, CellEventArgs e) { if (e.Cell.Column.Key == "PORTFOLIO") { UltraGridBand brokerBandToFilter = this._cbbrok.DisplayLayout.Bands[0]; brokerBandToFilter.ColumnFilters.ClearAllFilters(); brokerBandToFilter.ColumnFilters["TRADE_TYPE"].FilterConditions.Add(FilterComparisionOperator.Equals, e.Cell.Row.Cells["TRADE_TYPE"].Value); brokerBandToFilter.ColumnFilters["PORTFOLIO"].FilterConditions.Add(FilterComparisionOperator.Equals, e.Cell.Row.Cells["PORTFOLIO"].Value); if (_cbbrok.Rows.VisibleRowCount > 0) //<===== { foreach (var row in _cbbrok.Rows) //<===== { if (!row.IsFilteredOut) //<===== { e.Cell.Row.Cells["CLEARING_BROKER"].Value = row.Cells["COUNTERPARTY_ID"].Value; //<===== break; } } } } }
You could simplify this a little, by using
foreach (var row in _cbbrok.Rows.GetFilteredInNonGroupByRows())
This will loop through only the visible rows, so you do not need the IsFilteredOutCheck. This would also account for rows that you hid explicitly by setting the Hidden property, in addition to those rows that are filtered out.
thanks Mike. that did work. i will mark as accepted answer.
But i have another question regarding the rows in _cbbrok. is there way to display only unique values?
i've bound it do a datasource that is distinct by another field in the datatable. i'm binding this cbo to the same data but displaying a different field. (one that happens to be repeating). can i just show distinct?
lmk if i'm not making sense.
thanks
Al
Hi Al,
The combo doesn't have any built-in functionality to remove duplicates from the list. You would have to do that on the data source, or else filter out the duplicates yourself, which probably wouldn't be very efficient.
Yeah that makes sense.
thanks Mike