We have an ultrawingrid that is on an ultratab. The UWG is located on the second tab. The grid is loaded in the from load event.
The UWG's first column has a checkbox header. We have a call which enables a save button in the AfterHeaderCheckStateChanged event.
When we change the tab to the second tab the AfterHeaderCheckStateChanged event is being fired.
1. Is there a better place to locate our save button call then in the AfterHeaderCheckStateChanged function?
2. What event on the grid fires the AfterHeaderCheckStateChanged event after changing tabs?
Thanks!
Justin
You might want to put a breakpoint in the AfterHeaderCheckStateChanged handler to see what is triggering the firing. From what I remember, a change in value of any of the cells in that column could cause the header check state to change, and if that is what is happening, it is functioning correctly.
If you are triggering the event, you could place the code that is causing that in a try/finally block, and set/clear a flag that signifies not to process anything in the AfterHeaderCheckStateChanged handler.
We've tried that.
This grid is loaded on the form load and at the point when we switch tabs we have no logic affecting the grid. When we added the breakpoint it does not appear that anything is triggering that event.
We are new to Infragistics controls, so sorry if we are missing something but we are stumped here.
Here is some additional info I have found while debugging today.
1. The call stack is in the "Afterheadercheckstatechanged" when it is being fired, nothing within my code is calling it.
2. It does not happen if the datatable is empty.
3. It does not happen if I comment out this line in the initilize layout function (which doesn't do me any good because I need it to be a checkbox).
"Selected").Header.CheckBoxVisibility =Infragistics.Win.UltraWinGrid.HeaderCheckBoxVisibility.WhenUsingCheckEditor
4. I have not found a way around it yet by using any of the tab change events.
Any ideas??? I am working with a deadline so your prompt reply is appreciated.
We upgraded to 10.2 this morning and I was able to recreate the issue using your test project. I simply changed the first column to be a checkbox. I've reattached the zip file with my changes.
Here are the steps to recreate.
1. Open the project and click on the second tab. Click on the check header once.
2. Go back to tab 1.
3. Go to tab 2, and at this point the "afterheadercheckstatechanged" event fires.
Hello Mark.
After looking at this sample, our developers have determined that this is not a bug.
This is actually an issue with the sample itself. The Header CheckBox is actually changing state twice, triggering two AfterHeaderCheckStateChanged events. The first state change is when the checkBox is clicked. The second occurs when the checkbox goes back to the Indeterminate state due to the synchronization triggered by visibility change from tab-selection.
The synchronization cannot assume the cell values in a column of datatype Int can be converted to a true/false value, so it is setting the CheckState of the Header CheckBox to "Indeterminate".
This can all be resolved in the sample by changing the DataType of the "Selected" column to 'bool', and assigning values of true/false instead of 1/0.
Please let me know if you have any questions.
Sincerely,
Charlie
Senior Developer Support Engineer
MCTS
Hi Charlie,
I've changed the data value to be returned to a true / false (this is a bound grid) instead of 1/0 and still the same issue. My column style is a checkbox. Is this correct? Am I missing something?
Thanks.
Hello Justin.
I have attached a modified version of the sample that we submitted for the development issue. I changed the "Selected" column to be of type boolean instead of integer and added some Debug.WriteLine statements into the code to show what is going on.
It will not fire the AfterHeaderCheckStateChanged event a second time when Tab2 is activated the second time. Switching tabs doesn't cause this event to fire again when no values have changed in the grid.
CharlieSenior Developer Support EngineerMCTS
Hello,
I have the same problem with my Grid and AfterHeaderCheckStateChanged event.
This event is NOT ONLY raised when user click on header checkbox.
As I myself synchronizes data, rows are checked/unchecked abnormally.
Here is the code to format column in checkbox:
G_secu:DisplayLayout:Bands[0]:Columns[pi_colonne]:Style = Infragistics.Win.UltraWinGrid.ColumnStyle:CheckBox.G_secu:DisplayLayout:Bands[0]:Columns[pi_colonne]:Header:CheckBoxVisibility = HeaderCheckBoxVisibility:Always.G_secu:DisplayLayout:Bands[0]:Columns[pi_colonne]:CellActivation = Activation:AllowEdit.G_secu:DisplayLayout:Bands[0]:Columns[pi_colonne]:CellClickAction = CellClickAction:Edit.G_secu:DisplayLayout:Bands[0]:Columns[pi_colonne]:Header:CheckBoxSynchronization = HeaderCheckBoxSynchronization:None.
Thank you
Justin,
Did you get a chance to look over the new version of the sample that I attached? Let me know if you still require assistance with this case. Otherwise I would like to close it.
Thank you for using Infragistics.
Michael S.
I just want to make sure we are on the same page here. I modified the sample slightly to simplify the situation. There is only one grid. It is in the second tab. When the application is first loaded the first tab is selected. When you click on the second tab you will see the grid and the AfterHeaderCheckStateChanged event fires. If you go back to the first tab and then come back to the second tab again that event does not fire.
Do you see something different? Are you saying that this event fires any time we select the second tab? I am not seeing that.
I have a Debug.Writeline in the AfterHeaderCheckStateChanged event (and one in the Form_Load event).
Let me know what you see.
Yes. When testing on the initial load it hits the "afterheadercheckedchangedevent" for the grid. When we change tabs it hits the same event again just like the problem that we are having in our code.
This sample recreates our issue. When you run this example are you not seeing the same behaviour?
Were able to download and test the sample that Charlie attached? Please let us know if you need any further assistance with this case.