|
Rank: Member Groups: Member
Joined: 9/6/2007 Posts: 29
|
This code works well:
Code: HTML/ASPX
<eo:StaticColumn DataField="StartDateTime"
HeaderText="Day" SortOrder="Ascending"
DataType="DateTime" DataFormat="dddd"
AllowSort="true"/>
And formats the code to show the full day-of-week (eg: Sunday) However, in trying to get the time in military format this code does not work:
Code: HTML/ASPX
<eo:StaticColumn DataField="StartDateTime"
HeaderText="Start Time"
DataType="DateTime" DataFormat="HH:mm"/>
Regardless of the value, it always shows the time as 00:00and:
Code: HTML/ASPX
<eo:StaticColumn DataField="StartDateTime"
HeaderText="Start Time"
DataType="DateTime" DataFormat="hh:mm"/>
Regardless of the value, it always shows the time as 12:00Thoughts?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
We verified with the latest build and it appears to work fine. You will get 00:00 or 12:00 when the time part of your source data is indeed mid night --- which means it only holds an exact date value. Can you verify your data source?
Thanks
|
|
Rank: Member Groups: Member
Joined: 9/6/2007 Posts: 29
|
In running my test I looked at the value for the cell in question right after binding
Code: C#
+ Value {12/27/2007 7:00:00 AM} object {System.DateTime}
However the display in the grid still shows 12:00 or 00:00 depending on the DataFormat
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Would you be able to create a simple test page for us to demonstrate the problem? You can create a simple object with a DateTime property, let that property to return a date time value, create an one element array containing that object, then bind the array to the Grid.
|
|
Rank: Member Groups: Member
Joined: 9/6/2007 Posts: 29
|
Sorry, it took a long time to figure out why my test code succeeded and my real code failed. Ends up that it has to do with the DateTime object itself.
Code: C#
List<MyObject> list = new List<MyObject>();
list.Add(new MyObject(new DateTime(2007, 12, 27, 7, 0, 0))); // Failure
list.Add(new MyObject(new DateTime(2007, 12, 27, 7, 1, 0))); // Failure
list.Add(new MyObject(new DateTime(2007, 12, 27, 7, 0, 1))); // Failure
list.Add(new MyObject(new DateTime(2007, 12, 27, 0, 1, 1))); // Failure
list.Add(new MyObject(new DateTime(2007, 12, 27, 7, 1, 1))); // Success
Grid1.DataSource = list;
Grid1.DataBind();
It appears that if any of Hours, Minutes or Seconds are 0 then the DataFormat="HH:mm" returns 00:00 Thoughts?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
That is indeed the problem! We will look into it and should be able to fix it shortly.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
We have fixed the problem and posted 2007.2.16. Please download it from our download page and see if it fixes the problem.
DataFormat for DateTimeColumn should also be in the form of "{0:xxxx}" in this version like other type of columns. So if you previous have DataFormat set to "HH:mm", you need to set it to "{0:HH:mm}" in this version, otherwise you will get a JavaScript error.
Thanks
|
|
Rank: Member Groups: Member
Joined: 9/6/2007 Posts: 29
|
Thanks. This version works much better.
|
|