Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Linking Calendar day numbers to event details View modes: 
User avatar
Member
Member
terrence.porretto-go2vanguard - 9/14/2012 7:04:13 PM
   
Linking Calendar day numbers to event details
I would like to know where I can make the calendar day number into the link that leads to the event detail?

My design is a calendar with the event previews on the right side, if a day is a color other that white or gray it can be clicked on to show the event summary on the right. From there, a link will let them click through to the full event detail page.

I pretty sure I'd have to update the transformation so it includes the day number?

User image

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 9/15/2012 12:43:52 PM
   
RE:Linking Calendar day numbers to event details
What if you have more than one event on that day?
Since you have that nice detail of the selected day, I would put links there. I am not sure how you are generating your markup, but what I think would work is this:

I am going to assume that you are going to be creating a custom webpart for this and that you have average .Net development skills and know how to use the Kentico TreeEngine API to query the document tree.

In your custom webpart:

Write some code that will let you iterate through the days of a month (I'll let you figure this out)

For each day in the month, query the document tree for events in that month. If a month has events, mark it in your calendar control. Output the events with titles and links to the event detail inside a div or something that you hide with style display:none and you give the container an attribute that you can easily use to link it up to the selected date in the calendar.

Write some javascript that will show the content of the selected date's events in your detail pane.


Advanced Method:

Write a regular sql query that will return a list of dates in the selected month that have events (don't forget to put in the where clause to get events for the current site, culture, and that are published). Store the results in a generic list of List<DateTime> or something that you can compare to the dates as you go through them to mark your calendar.

Iterate through your list of dates with events and mark them on your calendar however you are able to.

Write a generic handler that you can pass the selected date to. This handler will query the document tree for events on that date and return them in a JSON array with the data you need to render a title and link to the detail page using a jQuery Ajax call. On successful Ajax response, iterate through the array and inject the links into the selected date detail panel on your calendar.

When the user changes the month, use an ajax call to the handler again, this time pass a selected month and have the handler return JSON for months that have events. Use the returned JSON to mark the days in your calendar.

Using this method won't require any page postbacks and you don't have to render as much markup so it will be much faster and more efficient. It does require some advanced knowledge of ASP.NET, Javascript, JSON, and jQuery though.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 9/15/2012 9:48:40 PM
   
RE:Linking Calendar day numbers to event details
Hi,

How to publish events in the calendar is described in the Developer's guide.

Best regards,
Juraj Ondrus

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 9/17/2012 12:42:32 PM
   
RE:Linking Calendar day numbers to event details
Or you can use the built in feature like Juraj suggested. It won't look like your screen shot though.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 9/18/2012 12:42:58 AM
   
RE:Linking Calendar day numbers to event details
Hi,

It is also matter of styling :-)

Best regards,
Juraj Ondrus