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

CheckboxList inside UpdatePanel and DP 8.1 SP1 or higher

Asked by Chris
8 years ago.

Hi,

I recently tried to update our web application from DP 8.1 to DP 8.1 SP5.
However after that update I noticed that a asp:CheckboxList inside an UpdatePanel (next to DaypilotScheduler) was not working correctly anymore. The CheckboxList controls resources for the scheduler.

I changed back to DP 8.1 and the CheckboxList worked properly again.
I tried all the service packs of 8.1 and starting from SP1 the checkbox list won't work.
I added another dummy checkbox list that has no interaction with the scheduler and it's not working.

The wrong behavior is as follows:
I can check unchecked boxes (EventHandler for SelectedIndexChanged is called)
I cannot uncheck checked boxes (EventHandler for SelectedIndexChanged is NOT called, when Page_Load is called the ListItems have already a wrong "Selected" property)
The above is true for every box except the last one, no matter how many boxes are in the list.

Firefox console does not show any errors. I tested with IE11 and Firefox 44.0.2

CheckboxList looks like this (items are added in code behind)

<asp:CheckBoxList ID="cblTPMDFE" runat="server" AutoPostBack="True" Font-Italic="True" RepeatDirection="Horizontal"/>

Any idea why this could be happening?

I know, this does not really sound like a proplem of DP but that is the only thing I changed.
I saw that in SP1 a client init was introduced, maybe it got something to do with that?

Thanks in advance and kind regards
Chris

Comment posted by Dan Letecky [DayPilot]
8 years ago.

Please let me check that. At first sight, I don't see how DayPilot could affect the checkbox control but it's still possible.

Comment posted by Dan Letecky [DayPilot]
8 years ago.

I've created the following simple test page:

SchedulerUpdatePanelCheckBoxList.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SchedulerUpdatePanelCheckBoxList.aspx.cs" Inherits="Scheduler_UpdatePanelCheckBoxList" %>
<%@ Register Assembly="DayPilot" Namespace="DayPilot.Web.Ui" TagPrefix="DayPilot" %>
<!DOCTYPE html>
<html>
<head>
    <title>UpdatePanel Test</title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel runat="server" ID="UpdatePanel1">
        <ContentTemplate>
            <asp:Label runat="server" ID="Label1"></asp:Label>
            <asp:CheckBoxList runat="server" ID="CheckBoxList1" AutoPostBack="true" OnSelectedIndexChanged="OnSelectedIndexChanged">
                <asp:ListItem Text="Alabama" Value="Alabama"></asp:ListItem>
                <asp:ListItem Text="Alaska" Value="Alaska"></asp:ListItem>
                <asp:ListItem Text="Arizona" Value="Arizona"></asp:ListItem>
                <asp:ListItem Text="Arkansas" Value="Arkansas"></asp:ListItem>
                <asp:ListItem Text="California" Value="California"></asp:ListItem>
                <asp:ListItem Text="Connecticut" Value="Connecticut"></asp:ListItem>
            </asp:CheckBoxList>
            <DayPilot:DayPilotScheduler ID="DayPilotScheduler1" runat="server">
                <Resources>
                    <DayPilot:Resource Name="Room 1" Id="A" />
                    <DayPilot:Resource Name="Room 2" Id="B" />
                    <DayPilot:Resource Name="Room 3" Id="C"  />
                    <DayPilot:Resource Name="Room 4" Id="D" />
                </Resources>
            </DayPilot:DayPilotScheduler>
        </ContentTemplate>
    </asp:UpdatePanel>
    </form>
</body>
</html>
SchedulerUpdatePanelCheckBoxList.aspx.cs
using System;

public partial class Scheduler_UpdatePanelCheckBoxList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void OnSelectedIndexChanged(object sender, EventArgs e)
    {
        Label1.Text = "" + CheckBoxList1.SelectedIndex;
    }
}

But it seems to work fine. Would you be able to modify this demo so it reproduces the issue?

Comment posted by Chris
8 years ago.

To be honest, I already tried that (build a mini demo project that shows the error).
No luck so far. I'll try to add some dummy event data, maybe that will do trick.

Nonetheless thank you so far!

Comment posted by Dan Letecky [DayPilot]
8 years ago.

You can also try watching the network communication using Chrome/Developer Tools/Network tab.

1. Do you see the request there after clicking the checkbox?
2. If so, what's the response?

Comment posted by Chris
8 years ago.

I used firefox dev tools but I see the request.
Before I click on a checkbox the first three are checked and the sixth.
I try to uncheck the third checkbox and the parameters of the request look like this:

__EVENTTARGET:"ctl00$ContentPlaceHolder1$cblTPMDFE$2"
__EVENTARGUMENT:""
(...)
ctl00$ContentPlaceHolder1$cblTPMDFE$0:"on"
ctl00$ContentPlaceHolder1$cblTPMDFE$1:"on"
ctl00$ContentPlaceHolder1$cblTPMDFE$5:"on"

That does look like the correct state of the third checkbox is sent to the server, doesn't it?
However, when I look in the preview tab the third checkbox is still checked.

BUT, after alle GETs there is one more POST that looks like this:

__EVENTTARGET:""
__EVENTARGUMENT:""
(...)
ctl00$ContentPlaceHolder1$cblTPMDFE$0:"on"
ctl00$ContentPlaceHolder1$cblTPMDFE$1:"on"
ctl00$ContentPlaceHolder1$cblTPMDFE$2:"on"
ctl00$ContentPlaceHolder1$cblTPMDFE$5:"on"
__CALLBACKID:"ctl00$ContentPlaceHolder1$Scheduler"
__CALLBACKPARAM:"JSON{"action":"Init","type":"CallBack","header": (...)

I'll try and do the same with DP8.1 where the CheckboxList is working...

Comment posted by Dan Letecky [DayPilot]
8 years ago.

The second POST is firing the ClientInit event using CallBack.

In the latest sandbox build (8.1.3492) the ClientInit event is disabled by default (it's configurable using ClientInitEventEnabled property).

http://www.daypilot.org/sandbox/

You can give it a try with the sandbox build to see if it fixes the problem.

Answer posted by Chris
8 years ago.

Hi Dan,

yup, disabling the client init event fixed the checkbox list!

When will the next service pack be released so I can use the newest build? The sandbox is only available as trial right?

Thanks once again for the great support!

Comment posted by Dan Letecky [DayPilot]
8 years ago.

Chris,

Thanks for the update. The SP release will be available in a day or two.

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