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.
Unfortunately, activation email could not send to your email. Please try again.

DateTimeOffset Property Databinding

Thread ID:

Created:

Updated:

Platform:

Replies:

121703 Jan 18,2016 07:34 AM Jan 19,2016 11:33 PM ASP.NET MVC 3
loading
Tags: Grid
Prasanth
Asked On January 18, 2016 07:34 AM

Hi there,

In a project I am working on there are classes with DateTimeOffset properties which needs to be displayed on controls like Grid and DateTimePicker etc.

I have noticed that when I am editing the columns bound to these properties data seems to be not displaying and while saving data is not displaying the new value on the column.  However I can see the data is actually changed and able to see the change via BatchUpdate method.

I have attached couple of screen shots along with this thread with Pre and Post user change of the field.

Is there a way to display DateTimeOffset field as corresponding local date/time while also able to display the updated value within the column.

Are there any issues with DateTimeOffset properties being bound to other MVC controls?

Also what is the best way to display DateTime/DateTimeOffset in local format (e.g. 31/12/2001 but not 12/31/2001)

Regards
Prasanth



Attachment: Grid_DateTimeOffset_Column_c239ea20.zip

Prasanna Kumar Viswanathan [Syncfusion]
Replied On January 19, 2016 06:40 AM

Hi Prasanth,

Thanks for contacting Syncfusion support.



     Queries
       Response
“While editing the columns proper data not displaying”

We have created a sample in batch editing with DateTimeOffset properties and we are able to display proper data while editing the columns.

public DateTimeOffset? OrderDate

        {

            get;

            set;
        }



Please find the screenshots:


 

After Editing:

 


“While saving the data the new date is not displayed”

While saving the data, we are able to get the new date in the date column.

Please find the screenshot:

 

“To display the datetime in local format”

To mention the datetime in local format, we suggest you to use Format API in the columns of ejGrid.

Please find the code example:

col.Field("OrderDate").HeaderText("Order Date").TextAlign(TextAlign.Right).Width(80).Format("{0:MM/dd/yyyy hh:mm:ss}").EditType(EditingType.DateTimePicker).Add();


Refer the below link for the various types of formats

Link : http://mvc.syncfusion.com/demos/web/grid/columnformatting

Sample: http://www.syncfusion.com/downloads/support/forum/121703/ze/Sample1105674821




Please provide the following details it will help us to reproduce the mentioned issue.


1.       Share the code example.

2.       Share the screenshot of an issue, if you face any script errors while editing the columns.


3.       Essential Studio version details.


Regards,
Prasanna Kumar N.S.V


Prasanth
Replied On January 19, 2016 07:37 AM

Hi Prasanna,

Thanks for the source code.  The issues seems to be related to format not being specified.  Soon as I added the foll0wing the issues I have mentioned disappeared.

.Format("{0:dd/MM/yyyy hh:mm:ss}")

Previously I didn't specify any formatting details.  Thanks again

Regards
Prasanth

Prasanna Kumar Viswanathan [Syncfusion]
Replied On January 19, 2016 11:33 PM

Hi Prasanth,
 
We are happy that the provided solution working fine at your end. 
 
Regards,

Prasanna Kumar N.S.V


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;