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

DateTimeEdit Cell Type

When using a DateTimeEdit cell is it possible to change the NoneDateText value of the DateTimeEdit control?

Similarly can you set CellValue of the cell so that it displays the NonDateText. It appears that DateTime.Today is the value when you select none in the DateTimeEdit control, but when that value it does not show "no date selected".

Is it possible to change that value also maybe to something like CultureInfo.CurrentCulture.Calendar.MaxSupportedDateTime?

void Model_CommitCellInfo(object sender, GridCommitCellInfoEventArgs e)
{
DateTime dt = Convert.ToDateTime(e.Style.CellValue);
if (dt == DateTime.Today)
{
_dataSource[e.Cell.ColumnIndex,e.Cell.RowIndex] = MyConstants.NoDateSelected;
}
else
{
_dataSource[e.Cell.ColumnIndex,e.Cell.RowIndex] = dt;
}
}

void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
Model[e.Cell.RowIndex, e.Cell.ColumnIndex].CellType = "DateTimeEdit";
Model[e.Cell.RowIndex, e.Cell.ColumnIndex].DateTimeEdit.DateTimePattern = DateTimePattern.LongDate;
Model[e.Cell.RowIndex, e.Cell.ColumnIndex].CultureInfo = new CultureInfo("en-US");
if (MyConstants.NoDateSelected == _dataSource[e.Cell.ColumnIndex,e.Cell.RowIndex])
{
e.Style.CellValue = DateTime.Today;
}
else
{
e.Style.CellValue = _dataSource[e.Cell.ColumnIndex,e.Cell.RowIndex];
}
}




5 Replies

MS Mohamed Suhaib Fahad A. Syncfusion Team June 9, 2009 09:40 AM UTC

Hi Andrew,

Thanks for using Syncfusion products.

Currently we do not have a feature to set the NoneDateText through the GridStyleInfo, this is a feature request, and we would certainly add it up. Please create a Direct Trac incident for following up on that request.

Please let me know if you want any more details.

Thanks,
Fahad
Grid.WPF Team
Syncfusion Inc.,


AS Andrew Snyder June 9, 2009 12:48 PM UTC

Do these questions also need to be feature requests?

Similarly can you set CellValue of the cell so that it displays the NonDateText. It appears that DateTime.Today is the value when you select none in the DateTimeEdit control, but when that value it does not show "no date selected".

Is it possible to change that value also maybe to something like CultureInfo.CurrentCulture.Calendar.MaxSupportedDateTime?


MS Mohamed Suhaib Fahad A. Syncfusion Team June 10, 2009 12:19 PM UTC

Hi Andrew,

Yes, the NoneDateText will be the feature implementation.

For the other one, you could set the style.DateTimeEdit.MaxDate = CultureInfo.CurrentCulture.Calendar.MaxSupportedDateTime,

Please let me know if you want any more details.

Thanks,
Fahad
Grid.WPF Team
Syncfusion Inc.,


AS Andrew Snyder June 10, 2009 01:41 PM UTC

Is there a date i need to set in order to see the nondatetext? It appears to be DateTime.Today, but that does not make the nondatetext appear?


MS Mohamed Suhaib Fahad A. Syncfusion Team June 11, 2009 09:15 AM UTC

Hi Andrew,

Like I mentioned, currently the DateEdit control itself shows the current date and that is why the NoneDateText is not getting shown. I have already informed the Tools team to look into this. Please create a Direct Trac incident for us to notify you when this is implemented. Let me know if you want any more details on this.

Thanks,
Fahad
Grid.WPF Team
Syncfusion Inc.,

Loader.
Live Chat Icon For mobile
Up arrow icon