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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Ignore PushButtonClick event for a GridControl if all cells do not pass validation

Thread ID:

Created:

Updated:

Platform:

Replies:

67739 Aug 29,2007 10:55 AM UTC Aug 30,2007 12:43 AM UTC WinForms 1
loading
Tags: GridControl
Edijs
Asked On August 29, 2007 10:55 AM UTC

Hi!

I have specified to some GridControl cells "CellValueType". I also have one "PushButton" cell.

If I enter invalid value in cell, I see an error message "[Entered Value] is no a valid value for [CellValueType]".

If I enter invalid value in a cell and press the "PushButton", the PusshButtonClick event is called.

How to avoid processin of PushButtonClick eventhandler, if all cells do not pass validation ?


Thanks,
Edijs

haneefm [Syncfusion]
Replied On August 30, 2007 12:43 AM UTC

Hi Edijs,

One you can do this by handling the MouseDown event and call CurrentCell.Validate() method to validate PushButton cell in a Grid. Here is a code snippet that shows this task.

void gridControl1_MouseDown(object sender, MouseEventArgs e)
{
GridControl _grid = sender as GridControl;
GridCurrentCell _gCurrentCell = _grid.CurrentCell;
int _irowIndex, _icolIndex;
bool _bisInsideGrid = _grid.PointToRowCol(new Point(e.X, e.Y), out _irowIndex, out _icolIndex);
if (_bisInsideGrid && ( _gCurrentCell.RowIndex != _irowIndex || _gCurrentCell.ColIndex != _icolIndex ) )
{
if (_grid.Model[_irowIndex, _icolIndex].CellType == "PushButton")
{
_gCurrentCell.Validate();
}
}
}

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.

Warning Icon 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.Close Icon

;