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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Column type

Thread ID:





18072 Aug 24,2004 03:56 AM UTC Aug 24,2004 06:29 AM UTC WinForms 1
Tags: GridControl
Administrator [Syncfusion]
Asked On August 24, 2004 03:56 AM UTC

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 06:29 AM UTC

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).


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon