search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Show Event Count

Asked by Stephanie
10 years ago.

How would I go about showing the event count on a day view calendar? I can compute the count using the DayPilotCalendar1_BeforeEventRender, but I cannot display it on the screen. Is there a method that is called at the end of the calendar rendering? I have tried displaying it in a Literal in the BeforeEventRender both using an UpdatePanel and not and that doesn't work. I tried in the Unload method, etc

Please Help!

Answer posted by Dan Letecky [DayPilot]
10 years ago.

1. Server side:

You can count the number of items in your DataSource. It should match the number of visible events provided that you limit the SELECT properly (using StartDate and EndDate). Note that the events that don't fit into the visible range are not sent from the server side.

2. Client side:

Check dpc.events.list array in AfterRender event handler:

<DayPilot:DayPilotCalendar
  ...
  ClientObjectName="dpc"
  AfterRenderJavaScript="alert('Number of events: ' + dpc.events.list.length)"
  ...
/>

Updating a Label using jQuery:

AfterRenderJavaScript='$("#label").html("Count: " + dpc.events.list)'
Comment posted by Stephanie
10 years ago.

Hello Dan,

Unfortunately the datasource never seems to have an accurate count, because of the exceptions etc selected by the sql query.

Thanks for the code. I got it working that way.

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.