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.

Column type

Thread ID:

Created:

Updated:

Platform:

Replies:

18072 Aug 23,2004 11:56 PM Aug 24,2004 02:29 AM Windows Forms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On August 23, 2004 11:56 PM

Hi Wiil this statement allows only integers in the cells of the column MyColumn datatable.Columns.Add(new DataColumn("MyColumn", typeof(int))); how to make cells accept only integers, decimals, strings etc ---seash

Administrator [Syncfusion]
Replied On August 24, 2004 02:29 AM

I assume you are trying to bind your datatable to a GridDataBoundGrid. If you do not explicitly add GridBoundColumns that change something, using that declaration to create a DataColumn should make the grid catch an exception, and display an error message if your user tried to type something that was not a valid integer. When you tried it, did it not work for you? Another place you can set the system.Type for a column is the GridBoundColumn.StyleInfo.CellValueType for the particular column. If you explicitly add the GridBoundColumns, then you access these columns through the grid.GridBoundColumns collection. If you have not explicitly added GridBoundColumns, then you use grid.Binder.InternalColumns to get at the GridBoundColumn for a particular column. Now the default support lets you user type anything, and then catches the exception as the user tries to leave the cell. If you want to validate the cell keystroke by keystroke (ie ignore keys that are invalid like letters in a integer), then you will have to handle the CurrentCellValidateString event, and validate teh e.Text that is passed in, setting e.Cancel = true if it is invalid. (You can get the row/col by getting the grid.CurrentCell.RowIndex/COlIndex).

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.

;