Hello,
I am using a EditorControl for a column in my ultragrid. The type of EditorControl I am using is UltraTextEditor and I added two StateEditorButtons to this control as depicted in the image I provided. The question that I have is that when you click one of the StateEditorButtons; making it checked value 'true', all cells in that column using the EditorControl StateEditorButton become checked as well, is there way to make this work only on the cell you clicked the StateEditorButton on? Please advise.
I attached the image so that you can see my dilemma when check state of the StateEditorButton changes for this column.
Adrian
Adrian,
You won't be able to trap the EditorButtonClick event of the control because you're now creating a clone of the editor that the control is not aware of. I think a better option is to hook the Click event of each editor and use that to change the state. You'd probably have to use the GetContext method on the button.Editor.ElementBeingEdited to get the UltraGridCell that is associated with the state button too.
As for looping through all cells, I mean that when you detect that the state has changed on a button, at that point you need to loop through all of the other rows to make sure that none of them are checked, assuming that you want these to behave like a radio button.
-Matt
Hello Matt
When you say loop them all, do you mean at time you are in the ultraGrid1_InitializeRow? Could you clarify for me please.
Also, I noticed when I used this way
private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e){ if (e.Row.Cells["Col 1"].Editor == null) { EditorWithText editor = (EditorWithText)this.ultraTextEditor1.Editor.Clone(null); e.Row.Cells["Col 1"].Editor = editor; }}
to get my desired result earlier that the ultraTextEditor1_EditorButtonClick no longer works. Is it now impossible to catch an event from these statebuttons with the change you suggested?
Thanks,
No, there is no built-in support to do this. You would have to loop through all the editors to manually sync them since there is no infrastructure in place for the editors to know that they should do this.
Hello Matt,
Sorry to bother you with another question. But, I was wonder if changed the DisplayStyle of those StateEditorButtons to RadioButton, is there a way to get them act like true radiobuttons?
The second option seems to be working really well for me. Thanks alot!