Hello,
I'm trying to get a column in WinGrid to update based on the input of another column. Both of these columns are using a WinCombo box as the EditorControl. To explain further:
I have a winGrid with a CustomerNumber column and a CustomerName column. The each column uses a ComboBox as the EditorControl. What I want to do is, when the user selects the CustomerNumber, the winGrid will update the CustomerName.
Here is where I'm at with my code:
if (WinGrid1.ActiveRow.Cells["CustNumber"].Value != WinGrid1.ActiveRow.Cells["CustName"].Value)
{
WinGrid1.ActiveRow.Cells["CustName"].EditorResolved.Value = WinGrid1.ActiveRow.Cells["CustNumber"].Value;
}
When I tried this, I get an error saying that the Editor is not in edit mode...so...I am trying this
WinGrid1.ActiveRow.Cells["CustName"].EditorResolved.EnterEditMode(I don't know what to enter here);
NOTE: Both ComboBoxes have thier Value property set to CustID
Hi Mike,
The code is in the _AfterCellUpdate event.
My client wants to see both fields as sometimes the users will enter by name and other times by number. Note, the customer number is separate from the CustID. I actually do resolve both fields back to the CustID...and use a LookupTable.
I tried using the UltraDropDown instead of ComboBoxes...that did the trick!!
Thanks
Hi Jimmy,
What event is this code in?
In any case, why display both fields to the user? Isn't that somewhat redundant? In a typical application, the table would only contain the customer ID and not the name. Having both fields in the same table means there's a chance of the data getting out of synch and can cause you hassles like the one you are having now.
What I would do is structure the data in two tables. One is the table you are displaying to the user. The other is a lookup table that links the customer ID to the name. Then you just attach a DropDown to the CustomerID column with a DataMember and DisplayMember so the user just sees the names and not the IDs (which are meaningless to a user).
Also, if you just want to provide a dropdown list in a cell, it's better to use a ValueList or an UltraDropDown control as the ValueList of the column, rather than using the EditorControl - unless you are adding editor button or using a DataFilter.