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

How can I get cell type(int64, short, string for example) from GridGrouping Control event TableControlCurrentCellErrorMessage

I try
//--
private void _gridGrouping_TableControlCurrentCellErrorMessage(object sender, GridTableControlCurrentCellErrorMessageEventArgs e)
{
private void _gridGrouping_TableControlCurrentCellErrorMessage(object sender, GridTableControlCurrentCellErrorMessageEventArgs e)
{
GridTableControl gridTableControl = _gridGrouping.GetTableControl("GENERIC_ITEM");

Type cellType = gridTableControl.CurrentCell.Renderer.CurrentStyle.CellValueType;
string errMessage = GetCellErrorMessage(e.TableControl.CurrentCell, cellType.GetType());

if (errMessage.Length > 0)
{
e.Inner.Cancel = true;
MessageBox.Show(errMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
e.Inner.Cancel = false;
}

}

I try but my table controls in my GridGroupingControl variable

1 Reply

AD Administrator Syncfusion Team December 18, 2006 04:18 AM UTC

Hi Vladymyr,

Use the Style.CellValueType property to get the type of the cell values in a Grid. Here is a below code snippet to show this.

private void grid_TableControlCurrentCellErrorMessage(object sender, GridTableControlCurrentCellErrorMessageEventArgs e)
{
//Get the CurrentCell value type in a grid.
GridCurrentCell cc = e.TableControl.CurrentCell;
GridStyleInfo style = cc.Renderer.CurrentStyle;
Type type = style.CellValueType as Type;
e.Inner.Cancel = true;
MessageBox.Show("CurrentCell Type : " + type.ToString() , "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon