Hello,
I'm working on an older application now which uses Ultragrid v3.1.
In the ultragrid the user can enter a date (with mask __/__/____). If there is allready a date in the cell and the user wants to clear it, he'll get an error when he leaves the cell ("Unable to update the data value: Value in the editor is not valid") . When there is a DBNull value in the database the ultragrid just shows an empty cell.
I want the user to be able to clear the date so that the cell will be empty again.
This Is what I've tried so far.
Private Sub UltraGridKlantengroep_Error(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.ErrorEventArgs) Handles UltraGridKlantengroep.Error Dim thisUltragrid As Infragistics.Win.UltraWinGrid.UltraGrid = CType(sender, Infragistics.Win.UltraWinGrid.UltraGrid) If (thisUltragrid.ActiveCell.Text = "__/__/____") Then Me.UltraGridKlantengroep.ActiveCell.Value = DBNull.Value End If e.Cancel = True End Sub
If I do this I get an unhandled exception:
Internal error: can't get masked editor value.
Inner exception: Input does not match the mask.
Any ideas how I can fix this?
Hi,
That's a really old version of the grid, so this might be a bug in the version you are using.
Try setting the Nullable property on the column to DBNull and see if that helps. If not, you might want to try some of the other values for that property and see if any of them work.
Setting the Nullable property to the different values didn't work (DBNull is null here)
It is the DateTimeEditor which throws the exception, because the mask isn't respected.
Is there a possibility to in case of an error put another editor on this cell?
Or any other solutions?
Hm, I'm confused about what's actually happening then. On which line of code is the exception occurring? Can you post the call stack of the exception?
This is the stacktrace (under e.DataErrorInfo.Cell.EditorResolved.Value)
at Infragistics.Win.EditorWithMask.GetEditorValue() at Infragistics.Win.EmbeddableEditorBase.GetDataFilterSourceValue(ConversionDirection direction, EmbeddableEditorOwnerBase owner, Object ownerContext) at Infragistics.Win.EmbeddableEditorBase.GetDataFilteredDestinationValue(ConversionDirection direction, Boolean& isValidConversion, EmbeddableEditorOwnerBase owner, Object ownerContext, String& validMessage) at Infragistics.Win.EmbeddableEditorBase.get_Value() at Infragistics.Win.EditorWithMask.get_Value() at Infragistics.Win.DateTimeEditor.get_Value()
Hello Gert,
Thank you for your feedback! Please let me know when you find some time to test this out with v12.2.
Have found a way to work around the problem.
In the KeyDown Event of the UltraGrid I checked if the delete key was pressed and if everything was selected in the cell (Me.Ultragrid.ActiveCell.SelLength =10) And also checked if the dateTypecolumn was DateTime.
Now I looked for the corresponding cell in the dataset that was bound to the ultragrid and set it's value to DBNull
Then I databinded the ultragrid again-> Me.Ultragrid.DataBind()
I haven't been able yet to check out the latest version of NetAdvantage that has probably solved this bug.
Did you try this with the trial version of NetAdvantage 12.2? If it does not work, could you please try to attach if possible a small sample project reproducing the above mentioned issue, I will be happy to take a look at it.