Home Forums WinForms controls Xceed Grid for WinForms The current cell’s ValueChanged event is not raised.

Viewing 1 post (of 1 total)
  • Author
  • User (Old forums)
    Post count: 23064
    #17787 |

    The reason why the current cell’s ValueChanged event is not raised is because you only subscribed to the ValueChanged event of the cell which was current at the time when the grid was loaded.

    What you will need to do is to subscribe to the ValueChanged event of each cell in the grid (via the DataRowTemplate) and in the method that will handle the ValueChanged event (currentCell_ValueChanged) check to see if the sender is the current cell.

    For example:

    //If you are setting the DataSource property then this will need to be done between
    // calls to the grid’s BeginInit and EndInit methods.

    gridControl1.DataSource = dataSet11.Tables[ 0 ];

    foreach( Xceed.Grid.DataCell cell in gridControl1.DataRowTemplate.Cells )
        cell.ValueChanged += new EventHandler( this.currentCell_ValueChanged );


    In the currentCell_ValueChanged method, you can then check if the cell whose value was changed is the current cell and if so do the appropriate processing.

    private void currentCell_ValueChanged( object sender, EventArgs e )
        if( ( ( Xceed.Grid.DataCell )sender ).IsCurrent )
            //your code

    Imported from legacy forums. Posted by Xceed admin (had 2111 views)

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.