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
The second two lines you listed here are almost exactly the same in VB. The only different is that you have to use parentheses instead of square brackets. And, of course, there are no semicolons at the end of each line in VB. The first line is a variable declaration in C#, so you just have to use a Dim statement in VB.
This is just from memory, so it may not be exactly right, but something like this:
Dim rootBand as UltraGridBand = this.citiesDropDown.DisplayLayout.Bands(0) rootBand.ColumnFilters.ClearAllFilters() rootBand.ColumnFilters("StateID").FilterConditions.Add(...)
Dim rootBand as UltraGridBand = this.citiesDropDown.DisplayLayout.Bands(0)
rootBand.ColumnFilters.ClearAllFilters()
rootBand.ColumnFilters("StateID").FilterConditions.Add(...)
Thank you for your help. it is working great now.
hi All, sorry to resurrect an old post but i'm having a problem with that example. (http://news.infragistics.com/winforms/codesamples/creating-a-dropdown-list-in-a-grid-cell-whose-list-values-are-dependent-on-another-cell.aspx)
i have a portfolio dropdown, when changed, should filter the strategydropdown.
portfolio_dropdown.ValueMember = "PORTFOLIO_CODE";
portfolio_dropdown.DisplayMember = "PORTFOLIO_CODE";
strategy_dropdown.ValueMember = "TRADING_STRATEGY";//this is the actual value_member and want to keep it that way. this dropdown is bound to a table that does have "PORTFOLIO_CODE" to match portfolio dropdown.
strategy_dropdown.DisplayMember = "TRADING_STRATEGY";
this line, in my example, is throwing a "key not found" exception when i use my tables.
rootBand.ColumnFilters["TRADING_STRATEGY"].FilterConditions.Add(FilterComparisionOperator.Equals, e.Cell.Row.Cells["PORTFOLIO_CODE"].Value);
Mike, are you out there somewhere? what am i missing?
thanks everyone
Yeah that makes sense.
thanks Mike
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.
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
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.
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; } } } } }