locked
SelectedIndexChanged event of Asp.Net CheckBoxList control is not firing due to PopupControlExtender RRS feed

  • Question

  • User-1736215771 posted

    I have created a multiselect dropdown list control by using textbox,checkboxlist,panel and popupcontrolextender.I have placed all the controls inside UpdatePanel. Now when i checked a checkbox in the CheckBoxList then SelectedIndexChanged of CheckBoxList getting fired but when i unchecked it then its not getting fired. However when i tried after removing PopupControlExtender in my given code then this event is firing correctly. I think PopupControlExtender causing the problem. Please help me to solve this issue ?

    Here is the code:

    <asp:UpdatePanel ID="updatepanelBizUnit" runat="server">
        <ContentTemplate>
            <asp:TextBox ID="txtBizUnit" runat="server" Width="147px" ReadOnly="true" TabIndex="1"></asp:TextBox>
            <asp:RequiredFieldValidator ID="valRequiredBizUnit" CssClass="validatorMessage" Display="Dynamic"
                ValidationGroup="VgroupPart" runat="server" ErrorMessage="The 'Business Unit' field is required."
                Text="*" ControlToValidate="txtBizUnit" ForeColor="" SetFocusOnError="True"></asp:RequiredFieldValidator>
            <asp:PopupControlExtender ID="txtBizUnit_PopupControlExtender" runat="server" Enabled="True"
                ExtenderControlID="" TargetControlID="txtBizUnit" PopupControlID="PnlBizUnit"
                OffsetY="14">
            </asp:PopupControlExtender>
            <asp:Panel ID="PnlBizUnit" runat="server" Height="116px" Width="145px" BorderStyle="Solid"
                BorderWidth="1px" Direction="LeftToRight" ScrollBars="Auto" BackColor="#FFFFFF"
                Style="display: none">
                <asp:CheckBoxList ID="ChkBizUnit" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ChkBizUnit_SelectedIndexChanged">
                </asp:CheckBoxList>
            </asp:Panel>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="ChkBizUnit" EventName="SelectedIndexChanged" />
        </Triggers>
    </asp:UpdatePanel>

    Monday, May 19, 2014 4:03 AM

Answers

  • User-417640953 posted

    Hi rbwaraich,

    Thanks for your post.

    I made a demo based on your code below.

    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager> 
            <asp:UpdatePanel ID="updatepanelBizUnit" runat="server">
                <ContentTemplate>
                    <asp:TextBox ID="txtBizUnit" runat="server" Width="147px" ReadOnly="true" TabIndex="1"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="valRequiredBizUnit" CssClass="validatorMessage" Display="Dynamic"
                        ValidationGroup="VgroupPart" runat="server" ErrorMessage="The 'Business Unit' field is required."
                        Text="*" ControlToValidate="txtBizUnit" ForeColor="" SetFocusOnError="True"></asp:RequiredFieldValidator>
                    <asp:PopupControlExtender ID="txtBizUnit_PopupControlExtender" runat="server" Enabled="True"
                        ExtenderControlID="" TargetControlID="txtBizUnit" PopupControlID="PnlBizUnit"
                        OffsetY="14">
                    </asp:PopupControlExtender>
                    <asp:Panel ID="PnlBizUnit" runat="server" Height="116px" Width="145px" BorderStyle="Solid"
                        BorderWidth="1px" Direction="LeftToRight" ScrollBars="Auto" BackColor="#FFFFFF"
                        Style="display: none">
                        <asp:CheckBoxList ID="ChkBizUnit" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ChkBizUnit_SelectedIndexChanged">
                             <asp:ListItem Text="one" Value="one"></asp:ListItem>
                             <asp:ListItem Text="two" Value="two"></asp:ListItem>
                        </asp:CheckBoxList>
                    </asp:Panel>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="ChkBizUnit" EventName="SelectedIndexChanged" />
                </Triggers>
          </asp:UpdatePanel>

    code behind:

       protected void ChkBizUnit_SelectedIndexChanged(object sender, EventArgs e)
            {
               ///set a break point....
            }

    It works fine in my side, the checkbox list postback when check and uncheck.

    Please check your code carefully and find what other reasions caused this problem. Thanks.

    Regards!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 19, 2014 10:44 PM