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. Image for the cookie policy date
close icon

How to edit a nullable time in a grid cell

I want to be able to edit a time value (hh:mm [am|pm]) in a grid, but it must also be nullable and the user must get a meaningful error if they have entered somethign incorrectly. I think i''d prefer free text that is flexible to allow the user to enter 10am or 10:00am or 10:30. having to click an up arrow to set a time can be very annoying. the trickier part is that is needs to be DBNull-able, so I would expect i''d want to let the user hit delete to delete it. whats the best approach? thanks -andy

3 Replies

AD Administrator Syncfusion Team June 24, 2004 11:10 PM UTC

what i did so far was to add ''t'' as the format string, which allows me to enter a time but a) it complains with an exception if i enter an invalid time b) i cant enter a null time c) the value is not evaluated until i move to a different row. when i tab to another column in the same row (or hit return) it doesnt evaluate the text i have entered what should i be doing? thanks -andy


AD Administrator Syncfusion Team June 25, 2004 06:35 AM UTC

You need to be using our 2.0 code base (or at least 1618 ???) to handle null DateTime''s. In those versions, there should not be a problem having an empty DateTime field unless you are bound to a datatable that does not allow null''s in the column. In that case, you will have to change the column in the DataTable to accept nulls. As far as accepting flexible strings and prviding your own error message, you can do that by handling CurrentCellValidating. Here is a little sample. NullableDateTime_3521.zip


AD Administrator Syncfusion Team June 25, 2004 07:33 PM UTC

great, thanks i am using 2.0 and its the CurrentCellValidating ''thing'' i was lookign for :) >You need to be using our 2.0 code base (or at least 1618 ???) to handle null DateTime''s. In those versions, there should not be a problem having an empty DateTime field unless you are bound to a datatable that does not allow null''s in the column. In that case, you will have to change the column in the DataTable to accept nulls. > >As far as accepting flexible strings and prviding your own error message, you can do that by handling CurrentCellValidating. Here is a little sample. > >NullableDateTime_3521.zip > >

Loader.
Live Chat Icon For mobile
Up arrow icon