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

Why does Calendar re-render after TimeRangeSelected event fires?

Asked by VG
11 years ago.

I am handling both TimeRangeSelected and BeforeEventRender events on my DayPilotCalendar. The TimeRangeSelected event causes a textbox outside of the calendar to become visible and that's it. We had reports that this performance was slow so I looked into it and noticed that the BeforeEventRender is also getting called for all the events after the TimeRangeSelected fires. My question is just why is the calendare re-rendering after the TimeRangeSelected event fires? Is there any way to let the calendar know that it doesn't need to re-render? Nothing on the calendar itself is changing so it should just stay as-is.

Thanks

  • VG
Answer posted by Dan Letecky [DayPilot]
11 years ago.

If you use TimeRangeSelectedHandling="JavaScript" it will only execute the the JavaScript defined in TimeRangeSelectedJavaScript (onTimeRangeSelected on the client side).

The server-side TimeRangeSelected event is only fired if you call dpc.timeRangeSelectedCallBack() or dpc.timeRangeSelectedPostBack() in TimeRangeSelectedJavaScript.

Comment posted by VG
11 years ago.

Dan, I am not refering to JavaScript. I have the TimeRangeSelectedHandling set to "PostBack", which is what I want it to do. My question is, why does the calendar re-render after this event is triggered? I don't understand why the postback requires the calendar to re-render instead of remaining as-is via Viewstate.

Thanks

  • VG
Comment posted by Dan Letecky [DayPilot]
11 years ago.

I see.

The BeforeEventRender event is called during data binding. If you avoid calling DataBind() the ViewState will be used instead. Note that calling DataBind() on the page will cascade to children as well.

Comment posted by VG
11 years ago.

Hi Dan, I do NOT call DataBind at all. As my original post indicated, "The TimeRangeSelected event causes a textbox outside of the calendar to become visible and that's it." So essentially txtExternalTexbox.Visible = True is all that the TimeRangeSelected event handler does. No databind. No databind called from Page_Load either. I even put a breakpoint in the databinding event - it never gets hit - but the BeforeEventRender event handler DOES get hit. Do you know why the calendar would re-render when there is no databinding? Could there be any other property that might cause the calendar to re-render every time a postback occurs?

Thanks

  • VG
Comment posted by Dan Letecky [DayPilot]
11 years ago.

Sorry for the confusion. You are right, it has nothing to do with DataBind().

You can see in the source code that BeforeEventRender is called from Render(). This method is called during initial page load and after every PostBack. This is how WebForms works.

The events themselves are stored in ViewState but they are always rendered.

You might be prevent Render from being called using a combination of UpdatePanels (one for DayPilotCalendar, one for the TextBox). Set UpdateMode to Conditional.

Comment posted by VG
11 years ago.

OK, I'll give that a try. Thank you for your help.

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