We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

CurrentCellChanged edit value

Hi,

I was wondering how i will be able to get the value that the user is currently typing in a cell in a GridDataControl.

I need it to validate the input as the user types it in.

I am using Unbound columns throughout my grid. So i use query cell info command, and the values of the cells aren't directly bound to any property.

Currently, I'm trying to use CurrentCellChanged event to try and get it. but there doesn't seem to be any reference to it in

SyncfusionRoutedEventArgs


Thanks!
Rich





1 Reply

RA Rajasekar Syncfusion Team January 31, 2012 07:08 AM UTC

Hi Rich,

Thank you for your update.

You can achieve your requirement by handling the below events based on your desired scenarios,

dataGrid.ActivateCurrentCellBehavior = GridCellActivateAction.ClickOnCell;
dataGrid.CurrentCellActivated += new Syncfusion.Windows.ComponentModel.GridRoutedEventHandler(dataGrid_CurrentCellActivated);
dataGrid.CurrentCellDeactivated += new GridCurrentCellDeactivatedEventHandler(dataGrid_CurrentCellDeactivated);

void dataGrid_CurrentCellDeactivated(object sender, GridCurrentCellDeactivatedEventArgs args)
{
(this.dataGrid.Model.CurrencyManager.CurrentCell.Renderer.CurrentCellUIElement as TextBox).PreviewKeyDown -= new KeyEventHandler(MainWindow_PreviewKeyDown);
}

void dataGrid_CurrentCellActivated(object sender, Syncfusion.Windows.ComponentModel.SyncfusionRoutedEventArgs args)
{
(this.dataGrid.Model.CurrencyManager.CurrentCell.Renderer.CurrentCellUIElement as TextBox).PreviewKeyDown += new KeyEventHandler(MainWindow_PreviewKeyDown);
}

void MainWindow_PreviewKeyDown(object sender, KeyEventArgs e)
{
//do your actions here
}

Please let us know if you have any queries.

Thanks,
Rajasekar



Loader.
Live Chat Icon For mobile
Up arrow icon