Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
802
Question about StateEditorButton
posted

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

Parents
  • 37774
    posted

    I think whats happening here is that the grid is using the same copy of the editor for every cell in the column and there isn't anything that will store the individual state for each of the cells.  To get around this, you will need an editor for each of the cells, though I think that creating an entirely new control isn't necessary and adds overhead.  You could create a new editor in the InitializeRow event, i.e.:

    private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
    {
        if (e.Row.Cells["Col 1"].Editor == null)
        {
            EditorWithText editor = new EditorWithText();
            editor.ButtonsRight.Add(new StateEditorButton());
            e.Row.Cells["Col 1"].Editor = editor;
        }
    }

    If you do want to set things up at design-time, you might be able to get away with:

     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;
        }
    }

    -Matt

Reply Children