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

always say it is not valid value of date time


i am using databoundgrid, i have a DateTime column in my datatable. when i bound to grid, i formated that cell to MM/dd/yyyy HH:mm:ss from preparedView. the default time portion is 00:00:00 . the problem is, if i mannually change the 00:00:00 to any thing 01:00:00 or similar. The grid complain it about "invalid value of datetime". any shining points to help ?

david


6 Replies

DC David Cui October 29, 2008 09:26 PM UTC


any answer to this question ?


>
i am using databoundgrid, i have a DateTime column in my datatable. when i bound to grid, i formated that cell to MM/dd/yyyy HH:mm:ss from preparedView. the default time portion is 00:00:00 . the problem is, if i mannually change the 00:00:00 to any thing 01:00:00 or similar. The grid complain it about "invalid value of datetime". any shining points to help ?

david





JJ Jisha Joy Syncfusion Team October 30, 2008 11:22 AM UTC

Hi David,

Thak you for your interest in Syncfusion Products.

I have tested the issue on a simple sample. But I am afraid I was not able to reproduce the issue. Please refer the sample:
http://websamples.syncfusion.com/samples/Grid.Windows/GGCDateTimeFormattingIssue.zip

Please have a look at the above sample and if still the issue exists, could you please try reproducing it in the above sample or send us the reproducing steps so that we could sort out the cause of the issue and provide you a solution?

Regards,
Jisha





DC David Cui October 30, 2008 01:47 PM UTC


you are using GridGroupControl which I am using GridDataBoundGrid. what I did is simple just implment prepareview, e.Style.Format = "MM/dd/yyyy HH:mm:ss" . can you replace your control with data bound grid in your provided example.
then implement the prepareview as following
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if (e.ColIndex == 2)
{
e.Style.Format = "MM/dd/yyyy HH:mm:ss ";
}
}

David



>Hi David,

Thak you for your interest in Syncfusion Products.

I have tested the issue on a simple sample. But I am afraid I was not able to reproduce the issue. Please refer the sample:
http://websamples.syncfusion.com/samples/Grid.Windows/GGCDateTimeFormattingIssue.zip

Please have a look at the above sample and if still the issue exists, could you please try reproducing it in the above sample or send us the reproducing steps so that we could sort out the cause of the issue and provide you a solution?

Regards,
Jisha







JJ Jisha Joy Syncfusion Team October 31, 2008 10:58 AM UTC

Hi David,

Thanks you for your update.

Please try to use the below code for formatting column and let me know if this meet your requirements.

this.gridDataBoundGrid1.Binder.InternalColumns["ColumnName"].StyleInfo.Format = "MM/dd/yyyy HH:mm:ss ";

Regards,
Jisha



DC David Cui October 31, 2008 05:38 PM UTC

thx, Jisha,

It works.

David

>Hi David,

Thanks you for your update.

Please try to use the below code for formatting column and let me know if this meet your requirements.

this.gridDataBoundGrid1.Binder.InternalColumns["ColumnName"].StyleInfo.Format = "MM/dd/yyyy HH:mm:ss ";

Regards,
Jisha





JJ Jisha Joy Syncfusion Team November 6, 2008 09:28 AM UTC

Hi David,

Thank you for your update.

Jisha


Loader.
Live Chat Icon For mobile
Up arrow icon