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.
Unfortunately, activation email could not send to your email. Please try again.

Editing a Cell

Thread ID:

Created:

Updated:

Platform:

Replies:

60261 May 1,2007 02:19 PM May 1,2007 06:08 PM Windows Forms 1
loading
Tags: GridControl
John
Asked On May 1, 2007 02:19 PM

When I click on a cell that is a Numeric Up Down it takes two clicks to change the value. I checked this by seeing if it is editing, using this.gridname.CurrentCell.IsEditing. Which doesn't switch to true until the second click. How do I get this to change so that when the cell is clicked once it changes the value.

Thanks again
-j

haneefm [Syncfusion]
Replied On May 1, 2007 06:08 PM

Hi John,

You can try this code snippet in CellButtonClicked event of the grid and let me know if this helps.

private void gridControl1_CellButtonClicked(object sender, GridCellButtonClickedEventArgs e)
{
GridControl grid = sender as GridControl;
if( !grid.CurrentCell.IsEditing )
{
grid.CurrentCell.MoveTo(e.RowIndex,e.ColIndex);
grid.CurrentCell.BeginEdit(true);
object cellText = grid.Model[e.RowIndex,e.ColIndex].CellValue ;
if( cellText != null && cellText.ToString() != string.Empty )
{
int i = int.Parse( cellText.ToString() );
if( e.ButtonIndex == 0 )///Up button
grid.Model[e.RowIndex,e.ColIndex].CellValue = i+1;
else//Down button
grid.Model[e.RowIndex,e.ColIndex].CellValue = i-1;
e.Cancel = true;
}
}
}

Best regards,
Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;