Forums

 
ForumForumMainstream Foru...Mainstream Foru...Feature Request...Feature Request...Suppress time in Suppress time in 'date' columns in GridViews
Previous Previous
 
Next Next
New Post
 2/3/2006 1:57 AM
 

Hi Paul,

If I select a date column in a GridView, and specify it as a date (not a datetime), it still lists with the time showing.

Can this be suppressed for date columns - or can you add a format string option in the GridView, as you've allowed in the DetailView?

Thanks! Keep up the good work!

New Post
 2/3/2006 6:37 AM
 

I don't know if this is the most elegant solution, but I've come up with a fix.

In file SplendidDynamic.cs, method AppendGridColumns(string, DataGrid) I added this code ...

if (String.Compare (sCOLUMN_TYPE, "BoundColumn", true) == 0)
{
  if (Sql.IsEmptyString (sLIST_NAME))
  {
    BoundColumn bnd = new BoundColumn();
    ...

    // Modification here
    if (sDATA_FORMAT.Equals("Date"))
      bnd.DataFormatString = "{0:d}";

    ...

 

New Post
 2/3/2006 3:07 PM
 

The grid already supports a date-only data format.  In the layout manager, just use the Data Format dropdown and select Date.

For an example, take a look at the Calls.ListView grid.  The Start Date only displays the date.

 

New Post
 2/3/2006 4:09 PM
 

I was choosing the "Date" data format, but it was displaying values with the date and time.

In my mod above, you can see the condition is checking whether the data format is "Date".

I wonder if it is a regional settings issue? For whatever reason, for me, it was still including the time.

New Post
 2/3/2006 6:58 PM
 

The problem with your fix is that the date/time will not get translated to the correct timezone.  This is not a problem if everyone uses the same timezone as the server, but as soon as one person strays, the data becomes invalid.

Date handling in the grid is performed in the class CreateItemTemplateLiteral.  I think the bug fix is to automatically use the CreateItemTemplateLiteral when the data format is Date or Currency. 

The solution that does not require a code fix is to change the Column Type to TemplateColumn.

 

Previous Previous
 
Next Next
ForumForumMainstream Foru...Mainstream Foru...Feature Request...Feature Request...Suppress time in Suppress time in 'date' columns in GridViews