GrapeCity MultiRow Windows Forms Documentation
Detect Value Changed (RadioGroupCell)

You can use the GcMultiRow.CellEditedFormattedValueChanged event to detect any changes in the checked status of the check box cell. Use the Cell.EditedFormattedValue property to get the edited value.

Using Code

This code creates a test template.

[VB]

Imports GrapeCity.Win.MultiRow

Dim radioGroupCell1 As New RadioGroupCell()
radioGroupCell1.Items.AddRange(New String() {"ItemA", "ItemB"})
radioGroupCell1.Size = radioGroupCell1.PreferredSize
GcMultiRow1.Template = Template.CreateGridTemplate(New Cell() {radioGroupCell1})

[CS]

using GrapeCity.Win.MultiRow;

RadioGroupCell radioGroupCell1 = new RadioGroupCell();
radioGroupCell1.Items.AddRange(new string[] {"ItemA", "ItemB"});
radioGroupCell1.Size = radioGroupCell1.PreferredSize;
gcMultiRow1.Template = Template.CreateGridTemplate(new Cell[] { radioGroupCell1 });
This code shows the current value when the user changes the checkbox status.

[VB]

Imports GrapeCity.Win.MultiRow

Private Sub GcMultiRow1_CellEditedFormattedValueChanged(ByVal sender As System.Object, ByVal e As CellEditedFormattedValueChangedEventArgs) Handles GcMultiRow1.CellEditedFormattedValueChanged

    Dim gcMultiRow As GcMultiRow = TryCast(sender, GcMultiRow)
    Dim currentCell As Cell = gcMultiRow.Rows(e.RowIndex).Cells(e.CellIndex)

    If e.Scope = CellScope.Row Then
        If TypeOf currentCell Is RadioGroupCell Then
            Console.WriteLine("Cell value being edited: {0}", currentCell.EditedFormattedValue)
            Console.WriteLine("Cell Value: {0}", currentCell.Value)
        End If
    End If
End Sub

[CS]

using GrapeCity.Win.MultiRow;

private void gcMultiRow1_CellEditedFormattedValueChanged(object sender, CellEditedFormattedValueChangedEventArgs e)
{
    GcMultiRow gcMultiRow = sender as GcMultiRow;
    Cell currentCell = gcMultiRow.Rows[e.RowIndex].Cells[e.CellIndex];
    
    if (e.Scope == CellScope.Row)
    {
        if (currentCell is RadioGroupCell)
        {
            Console.WriteLine("Cell value being edited: {0}", currentCell.EditedFormattedValue);
            Console.WriteLine("Cell Value: {0}", currentCell.Value);
        }
    }
}
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options