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
100
UltraDateTimeEditor - Format No Year
posted

Good afternoon.

Is there a way to format the UltraDateTimeEditor to only show a month/day within an Infragistics Grid? The user's don't want to see the year when choosing a range. For example: 01/01 to 12/31.

The value underneath can include the year but the visual month/day must not include the year. The code below works fine for my purposes for all dates until you test a leap year. The result is 12/29 and the grid / editor continues to throw errors for the invalid date since there is no year associated. Is there a way to supress the error or change the format as I have described above?

I have used this code to achieve the results:

string userDateFormat = GetUserDateFormat();
string userDateFormatNoYear = userDateFormat.Replace("/yyyy", "");

// Start Date
row.Cells[START_DATE].Column.Format = "";
uiDayMonthEditor.MaskInput = userDateFormatNoYear.ToLower();
uiDayMonthEditor.FormatString = userDateFormatNoYear;
row.Cells[START_DATE].EditorControl = uiDayMonthEditor;
row.Cells[START_DATE].Column.UseEditorMaskSettings = true;

- Christopher

Parents Reply Children