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.

Problem with cell validation...

Thread ID:

Created:

Updated:

Platform:

Replies:

865 Aug 26,2002 05:34 PM Nov 14,2002 12:55 PM Windows Forms 6
loading
Tags: GridControl
Sheldon Barr
Asked On August 26, 2002 05:34 PM

I'm using a GridDataBoundGrid and I've added a number of columns using the GridBoundColumn Collection Editor in VS.NET. One of the columns is bound to a floating point number and I'm trying to use the ValidateValue item to do automatic validation of cells in that column. I have set the item values as follows. NumberRequired = True Minimum = 0.01 Maximum = 24 Unfortunetly, this does not have any effect, I can still enter any value into the cells. Is there something else I need to do to get validation working? Thanks.

Clay Burch [Syncfusion]
Replied On August 27, 2002 03:30 AM

This appears to be a bug. Setting these values in the designer did not 'take'. We'll get this fixed. However, I was able to get these values to 'take' by explicitly setting them in an Form Load event handler with code such as: //C# this.gridDataBoundGrid1.GridBoundColumns["Quantity"].StyleInfo.ValidateValue = New GridCellValidateValueInfo(True, 0.01, 1000, "bad number") 'VB.NET Me.GridDataBoundGrid1.GridBoundColumns("Quantity").StyleInfo.ValidateValue = New GridCellValidateValueInfo(True, 0.01, 1000, "bad number")

Sheldon Barr
Replied On August 27, 2002 06:23 PM

Clay, thanks for the workaround, but there seems to be a problem indexing the GridBoundColumn by name. My GridBoundColumn is called 'hoursColumn' in the VS.NET designer and it is the 3rd column (index 2). The following code returns null. gridDataBoundGrid1.GridBoundColumns["hoursColumn"] Whereas this code returns the correct column object. gridDataBoundGrid1.GridBoundColumns[2] I'm using this as a workaround to my problem, hope this makes sense.

Clay Burch [Syncfusion]
Replied On August 28, 2002 04:16 AM

Is "hoursColumn" the MappingName for your GridBoundColumn, or is it the HeaderText? Is it also the exact case? Thanks

Sheldon Barr
Replied On August 28, 2002 11:12 PM

Ok, "hoursColumn" is the design name of the column. I tried using the HeaderText of the column and that worked. I seem to have run into another problem though. The AllowEnter attribute doesn't seem to work whether I set it through the designer or directly in code. I have a column "notesColumn" with CellType=TextBox and AllowEnter=false but the column still allows newlines to be entered. What's more, the previous column is the "hoursColumn" I described earlier, has AllowEnter=false, and pressing enter correctly moves the cursor to the next column but inserts a newline there. I have ActivateCurrentCellBehaviour=SelectAll set for the table so this also has the unhappy side-effect of deleting the text in the "notesColumn". I'd appreciate any guidance you could give me.

Clay Burch [Syncfusion]
Replied On August 29, 2002 03:08 PM

Sheldon, I tried to see this behavior in the attached simple sample. The first 2 columns are text columns and they both have AllowEnter = False, but I don't see this problem. Maybe you could spot some difference between this sample and what you are doing? Clay

Tom Le Blanc
Replied On November 14, 2002 12:55 PM

Is there any way to short-circut the ValidateValue.NumberRequired to allow for an empty cell? e.g. If a user enters a value in a validated cell and realizes it's the wrong cell, but doesn't want a zero in the cell. Do you have any sample code (VB preferred) on how to roll that using the GridCellValidateValueInfo? Thanks, Tom

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.

;