onDblClick fired more than once

Hello,
I’m using version 2.3 on the Scheduler, using c# and asp.net.
In my Page_Load event I’m creating the scheduler, using the following javascript function.

function initScheduler() {
var step = 5;
var format = scheduler.date.date_to_str("%H:%i");

scheduler.config.xml_date = "%Y-%m-%d %H:%i";

scheduler.config.show_loading = true;
scheduler.config.dblclick_create = true;
scheduler.config.start_on_monday = true;

scheduler.xy.scale_height = 20;
//scheduler.config.hour_size_px=240;
scheduler.config.hour_size_px = (60 / step) * 21;
scheduler.templates.hour_scale = function (date) {
    html = "";
    for (var i = 0; i < 60 / step; i++) {
        html += "<div style='height:21px;line-height:21px;'>" + format(date) + "</div>";
        date = scheduler.date.add(date, step, "minute");
    }
    return html;
}

scheduler.config.time_step = 5;
scheduler.config.first_hour = 9;
scheduler.config.last_hour = 19;
scheduler.config.details_on_dblclick = true;
scheduler.config.drag_resize = false;
scheduler.config.drag_create = false;
scheduler.config.details_on_create = true;
scheduler.config.edit_on_create = true;
scheduler.config.icons_edit = ['icon_delete'];
scheduler.config.icons_select = ['icon_delete'];

scheduler.locale.labels.unit_tab = "Units"
scheduler.locale.labels.section_custom = "Units";
scheduler.config.xml_date = "%Y-%m-%d %H:%i";

scheduler.templates.event_class = function (start, end, event) {
    return "s_" + event.servizio;
}

scheduler.config.multi_day = true;

scheduler.attachEvent("onDblClick", function (event_id, native_event_object) {
    doShowEvent(event_id);
    return false;
});

scheduler.attachEvent("onBeforeEventDelete", function (event_id, evt) {
    doDeleteEvent(event_id);
    return true;
});

scheduler.attachEvent("onEventChanged", function (event_id, event_object) {
    doMoveEvent(event_id, JSON.stringify(event_object));
});

scheduler.init('scheduler_here', null, "day");

}

It all works pretty much as I expected, but when I double click an event, it seems the onDblClick gets fired multiple times… It seems executing the above initialization function on Page_Load keeps adding event handlers instead of replacing the existing ones… The first time Page_Load is executed only one event is fired, the second times I get two consecutive dblClick events and so on.

What am I doing wrong?
What’s the best way to initialize the scheduler in an Asp.Net application?

TIA.
Fabio

adding event handlers instead of replacing the existing ones
attachEvent call adds new event handler , but not remove old ones ( they can be removed through detachEvent )

What’s the best way to initialize the scheduler in an Asp.Net application?
If it possible - it will work more stable if all initialization is done only once ( init code is outside of ajax update panel )

I’ve seen the detachEvent method, but I haven’t figured out a way to use it. I cannot understand what event ID I should pass to it to remove any previous event handlers (a sort of clearAllEventHandlers is what I’d need, as I’m reassigning them everytime).

When you attaching event handler it returns its ID, which can be used later for detaching, something like

var id = scheduler.attachEvent("onClick", function(){ do_some(); }) ... scheduler.detachEvent(id);