This is most probably a stupid question but yeah. How do I change the CheckState column that the CheckEditor is bound to programatically?
Basically, I have a dropdown that would determine what the CheckState bound column should be. The datasource etc all stays the same for the CheckEditor, it's only the CheckState that changes.
Hello Logan
Thank you for contacting. In order to understand the scenario i need little more information:
Do you have UltraCheckEditor in the UltraGrid?
What is the datatype of the Column?
Regards,
Hi Divya,
The CheckEditor is not in a UltraGrid. It is used standalone. I have a UltraCombo on a Winform that is bound. When the selection of that UltraCombo changes, the CheckState binding needs to change based on that selection.
As an example:
If I select Invoice from the Combo, which has index of say 1, then I need the CheckState binding to change to bindingsource.table.fieldxx
If I select Quote from the Combo, which has index of say 2, then I need the CheckState binding to change to bindingsource.table.fieldyy
The CheckEditor state is determined by the TYPE of document selected in the combo. Obviously, if the end user changes the CheckEditor selection from unchecked to check I need to save that as well in that particular field as well.
Hello Logan,
As per your requirement I set up a sample of UltraCheckEditor and UltraCombo, and on UltraCombo selection change I am change the CheckState of the checkEditor, and its all working fine.
Attached a sample application for the reference.
If this sample is not the correct demonstration of what you are tring to do , feel free to update it and send it back for further investigation.
CheckEditorCheckState.zip
Thanks for the quick reply. You were half way there. It's the databinding that I needed for for the CheckEditor. I think I might have figured it out. I'm quite new to c# and Winforms so it's a bit of a learning curve.
For the CheckEditor I assume I need to use something like this. I coded it with an if statement.
It seems to work with retrieving the checked state of the CheckEditor but not saving it if it has been checked or unchecked by the end user. I don't know if I'm missing something here. Obviously I use the following code before this to clear any previous databinding.
if (ultraComboEditor1.Value == "Quote") { ultraCheckEditor1.DataBindings.Clear(); ultraCheckEditor1.DataBindings.Add(new Binding("Checked", DataSet.Table, "TableColumn")); }