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

catch the message "is not a valid value for"

Thread ID:

Created:

Updated:

Platform:

Replies:

8910 Nov 26,2003 10:47 AM UTC Nov 26,2003 11:41 AM UTC WinForms 4
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On November 26, 2003 10:32 AM UTC

You would normally do user validation in CurrentCellValidating, and set e.Cancel = true if you validation fails. In this case, the grid leaves the focus on the currentcell, and you do not have to call BeginEdit. Will this work for you?

Markus Kraft
Replied On November 26, 2003 10:47 AM UTC

Hi, in the Eventhandler ValueGrid_CurrentCellEditingComplete i check the CellValueType of validity and go on with ValueGrid.CurrentCell.BeginEdit(). To catch the message in CurrentCellChanged, CurrentCellEditingComplete and CurrentCellValidating was not successful. On wich place can i do my CellValueType check and return to BeginEdit() before the message "is not a valid value for" appears? greetings markus

Markus Kraft
Replied On November 26, 2003 11:21 AM UTC

Hi Clay, in my CurrentCellValidating handler i check the CellValueType against the ColumnType of the DataSource Table. The "e.Cancel = true" dont cancel the message. Thats the way i do: private void ValueGrid_CurrentCellValidating(object sender, System.ComponentModel.CancelEventArgs e) { GridBoundColumn gbcTempCol = m_ValueGrid.Binder.InternalColumns[m_ValueGrid.Binder.ColIndexToField(m_ValueGrid.CurrentCell.ColIndex)]; DataTable dtSourceTable = m_ValueGrid.DataSource as DataTable; if(m_ValueGrid[m_ValueGrid.CurrentCell.RowIndex,m_ValueGrid.CurrentCell.ColIndex].CellValueType != dtSourceTable.Columns[(string)gbcTempCol.MappingName].DataType) { e.Cancel = true; } } Any suggestion? markus

Administrator [Syncfusion]
Replied On November 26, 2003 11:25 AM UTC

I would think your e.Cancel is never hit. The reason is that m_ValueGrid[m_ValueGrid.CurrentCell.RowIndex,m_ValueGrid.CurrentCell.ColIndex].CellValueType will always be the type in the gridboundcolumn. What you should do is to get the current text (grid.CurrentCell.Renderer.ControlText), and check if that new text can be parsed for your desired CellValueType which you get from the gridboundcolumn.

Markus Kraft
Replied On November 26, 2003 11:41 AM UTC

Yeah i found "my error", i must check against CellValue because CellValueType is always the correct type. thanks for help, now it works fine.

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

;