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
110
Ultragrid cell with checkbox and text
posted

Hi, 

I want to display one of the cells in the ultragrid as a checkbox alongwith some text.

I created a UltraCheckEditor and assigned it to cell's EditorControl property

using the code similar to below:-

                    UltraCheckEditor uce = new UltraCheckEditor();
                    uce.Text = "YO";
                    uce.CheckState = CheckState.Checked;
                    row.Cells["sample"].EditorControl = uce;

Now i have two questions:-

1. how do i access the property to check the checkstate of the UltraCheckEditor. Eventhough i uncheck the checkbox in GUI, the value remains Checked

                    UltraCheckEditor uce = row.Cells["sample"].EditorControlResolved as UltraCheckEditor;
                    if (uce.Checked)
                    {
                    // still checked :-( even after unchecking in the GUI
                     }

2. How do i catch the event when checkbox is checked or unchecked

Thanks,

 

 

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

     The check state is not stored by the Control, it's stored by the grid. It has to be, because the editor could service an entire column. So you need to check the Value property of the grid cell itself, not the editor. 

     row.Cells["sample"].Value

    If you want to track when the checkbox is changed, you can use the CellChange event of the grid. Note that the Value of the cell does not get updated in this event, though. The Value doesn't update until the focus is lost from the cell. So inside CellChange you will have to use the Text property of the cell instead of the Value. 

Children