Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
85
Ultragrid - Date format issue
posted

I am using UltraGrid to display a simple set of data with one of the fields being a varchar(10) field. This field stores date values. The grid is edit mode enabled. In order for me to take date inputs I have set the Style field in the band's column properties to Date. Also set the MaskInput to mm/dd/yyyy which is my desired input format. Despite all this, when the user wishes to edit the date value by expanding the date drop down, an error message pops up saying the length of the value is higher than the specified limit (10 is the limit). On looking further I noticed that the time element of the date is getting appended automatically i.e. instead of 01/04/2011 it is 01/04/2011 12:00:00 AM.

How can I get rid of the time part?

Parents
No Data
Reply
  • 469350
    Offline posted

    Why store dates in a varchar field? This will cause you all sorts of problems like the one you mentioned here. The colmun will not be sorted or filtered correctly and the DateTimeEditor will not be able to handle setting the value because it uses a DateTime object, not a string.

    If you really want to do this, you can try to get around the error you are getting by using a DataFilter to translate the date to and from a string that your data source can handle.

    You could also use a SortComparer to handle the sorting.

    But as a general rule, it would be a whole lot easier to just use a Date field for dates.

Children
No Data