Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > CustomTableControl and Date&Time format View modes: 
User avatar
Member
Member
Phil - 5/27/2011 5:48:50 AM
   
CustomTableControl and Date&Time format
Hello Kentico!

I´ve created one Custom Table with 3 attributes (ItemDate, ItemEventID, ItemNotes). One attribute (ItemDate) type is set to "Date & Time" and it´s Field type is set to "Calendar". Boxes "Edit time" and "View actual time" are unchecked.

I show the table using CustomTableDatalist. But there are 2 problems.

1) The field (ItemDate) shows this format (e.g 12.05.2011 0:00:00) - Why is there the stupid time? :-)

2) I have 10 pages, which names coresponding with EventID. Please, would you give me some hint, how to filter the CustomTable´s content by EventID?
On page ~/Events/5.aspx i have to show Date and Notes from EventID 5.

Thank you!
Best regards,
Phil

P.S. Můžete odpovídat v češtině :-)

User avatar
Member
Member
Phil - 5/28/2011 11:59:50 AM
   
RE:CustomTableControl and Date&Time format
No ideas? :-(

User avatar
Member
Member
lancetek - 5/28/2011 12:54:35 PM
   
RE:CustomTableControl and Date&Time format
I'll try to help, but I've never used custom tables.

The Custom Table Datalist has a 'WHERE condition' field undre 'Content filter', I'd put the restriction I wanted there. Go look in your database to see what the field names are and use something like 'eventId = 6' to try to restrict to eventId #6. The field also has a litte black arrow just to the left of it, and there you can build your own macro expression, to maybe dynamically read a query parameter (like if you wanted to look for the page name in your example of 5.aspx) and use that in the WHERE condition.

Lance

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 5/30/2011 2:37:49 AM
   
RE:CustomTableControl and Date&Time format
Hello,

Thanks Lance for the help. Here are my suggestions:

1) The date can be formatted if you use it in a transformation. For example:

<%# GetDateTime("NewsReleaseDate", "MM/dd/yyyy HH:mm") %>

It really depends where and how you are displaying the date.

2) A basic approach would be to use the WHERE condition as Lance wrote. To get the id (here the name of the page) you can use a custom macro and extract the name from the NodeAliasPath. or you can directly use on of the following macros to get the document name or the node name:

{%currentpageinfo.documentname%}

PS: We have to answer in English so others understand what's going on and it may also help them to solve their problems.

Best regards,
Boris Pocatko

User avatar
Member
Member
Phil - 5/31/2011 4:05:30 PM
   
RE:CustomTableControl and Date&Time format
;-) It works perfectly.
Thanks