2

I am trying to use UpdatePanels, PopupControlExtenders, and a custom control to create a dropdown list of checkboxes. It works for the most part except for 1 odd glitch I cant seem to find a way around.

EnhancedCheckboxList.cs

Default.aspx

Default.aspx.cs

In order to replicate the glitch you have to perform the following actions in the order below.

  1. Set A Dropdown to Role2
  2. Set B Dropdown to Role2
  3. Invert all A Authorities (Uncheck checked items and check unchecked items)
  4. Set B Dropdown to Role1
  5. View A Authorities (The items we unchecked in step 3 have become checked again)

For whatever reason unchecking the Authorities in step 3 has no effect but checking them does? I looked into getting the correct values from Request.Params but it doesnt look like that is giving me what I want. The glitch will only happen if you perform the steps in that order if you switch steps 2 and 3 it works fine.

OriginalMoose
  • 177
  • 16
  • Are you still seeing this behavior? Are the checked/unchecked `Authorities` being seen when you expand the `Authorities` EnhancedCheckboxList or in code-behind on posting from the button? – ethorn10 Dec 12 '14 at 00:28

1 Answers1

1

Would you consider eliminating the UpdatePanels? I was able to reproduce the glitch using your original code. Once I removed the UpdatePanels the glitch is no longer reproducible:

    <fieldset>
            <legend>Role</legend>
            <table width="500">
                <tr>
                <td>A</td>
                    <td valign="top">
                        <asp:DropDownList ID="Roles" runat="server" AutoPostBack="True" OnSelectedIndexChanged="roles_SelectedIndexChanged">
                        </asp:DropDownList>
                    </td>
                    <td valign="top">
<%--                        <asp:UpdatePanel ID="UpdatePanel" runat="server">
                            <ContentTemplate>--%>
                                <asp:TextBox ID="txtAuthority" Text="Authorities" runat="server" CssClass="txtboxaschkbox" Visible="false"></asp:TextBox>
                                <asp:Panel runat="server" ID="PnlAuth" Visible="false" CssClass="PnlDesign">
                                    <cc1:EnhancedCheckboxList ID="Authorities" runat="server">
                                    </cc1:EnhancedCheckboxList>
                                </asp:Panel>
                                <cc2:PopupControlExtender runat="server" ID="PceSelectAuthority" TargetControlID="txtAuthority"
                                    PopupControlID="PnlAuth" Position="Bottom"/>
<%--                            </ContentTemplate>
                            <Triggers>
                                <asp:AsyncPostBackTrigger ControlID="Roles" />
                            </Triggers>
                        </asp:UpdatePanel>--%>
                    </td>
                </tr>
                <tr>
                <td>B</td>
                    <td valign="top">
                        <asp:DropDownList ID="Roles2" runat="server" AutoPostBack="True" OnSelectedIndexChanged="roles2_SelectedIndexChanged">
                        </asp:DropDownList>
                    </td>
                    <td valign="top">
<%--                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>--%>
                                <asp:TextBox ID="txtAuthority2" Text="Authorities" runat="server" CssClass="txtboxaschkbox" Visible="false"></asp:TextBox>
                                <asp:Panel runat="server" ID="PnlAuth2" Visible="false" CssClass="PnlDesign">
                                    <cc1:EnhancedCheckboxList ID="Authorities2" runat="server">
                                    </cc1:EnhancedCheckboxList>
                                </asp:Panel>
                                <cc2:PopupControlExtender runat="server" ID="PceSelectAuthority2" TargetControlID="txtAuthority2"
                                    PopupControlID="PnlAuth2" Position="Bottom"/>
<%--                            </ContentTemplate>
                            <Triggers>
                                <asp:AsyncPostBackTrigger ControlID="Roles2" />
                            </Triggers>
                        </asp:UpdatePanel>--%>
                    </td>
                </tr>
            </table>

        </fieldset>
mga911
  • 1,536
  • 1
  • 16
  • 33
  • 1
    That will probably have to be the solution. We just added the update panels into the page because there is a password field on the page and users didn't like that it would clear out a password they entered. Thanks for the help, enjoy the bounty! – OriginalMoose Dec 12 '14 at 13:52