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

DayPilotMonth: Filter Events using BeforeEventRender()?

Asked by Simon Edwards
16 years ago.

My datasource contains events that I may want to filter-out under certain conditions. Is is possible to use the BeforeEventRender() to effectively 'cancel' the event?i.e. ....

e.Cancel = true;

...I know there's no cancel property on the event args, but can the same thing be achieved a different way? set the innerHTML to String.Empty perhaps? or maybe set the Start and End time to exactly the same Date/Time?

Comment posted by Lauwens
16 years ago.
First off, Start and End are ReadOnly so no changing there in the BeforeRender!

But what you are trying to do is reverse the whole logic... as you seem to have a parameter to filter things in the BeforeRender, why not filter it out in your datasource? Change your select query and filter them out before they are presented to the control!

Or you could always clear out the innerhtml and/or change the backgroundcolor

just put it in the beforeRender

if ('condition to filter')
   e.innerHTML = "";


hope this makes some sense

Comment posted by Lauwens
16 years ago.
Woops, sorry wrong 'pre' use there made the layout bit stretch
Comment posted by Dan Letecky
16 years ago.
Yes, Lauwens is correct: I recommend doing the filtering in the datasource. You have two choices:
  • Filter it using the SQL query (or stored procedure)
  • Replace SqlDataSource with a SqlDataAdapter.Fill() call and manual DataTable processing.
If you set e.InnerHTML = String.Empty in BeforeEventRender it will still render the event box.
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.