Checked Drop Down menu stays open in aspx, closes in ascx

4 posts, 0 answers
  1. Blair
    Blair avatar
    16 posts
    Member since:
    Jul 2013

    Posted 29 Jul 2013 Link to this post

    I have two RadComboBoxes - one in the main page, one in a user control.  They are identical in all ways other than data source and location. They both have multi-checkboxes enabled.

    When I expand the ASPX Drop Down menu and check an item, the control does a postback as expected and remains open to allow another item to be checked.  

    When I expand the ASCX Drop Down menu and check an item, the control does a postback as expected and closes the Drop Down menu.  This is undesirable behaviour and I would like it to function as the ASPX control does above.

    There are no RadAjaxManager calls here (I use empty UpdatePanels to keep the data updated without causing screen refreshes).  

    Any help?
  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 01 Aug 2013 Link to this post

    Hello,

    Thank you for contacting Telerik Support.

    I am afraid that I am not able to replicate the described issue. I am attaching a sample project implementing scenario very similar to yours. Could you please try to replicate the issue with that project and explain what exactly is different in your scenario or where is your update panel?


    Regards,
    Boyan Dimitrov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Blair
    Blair avatar
    16 posts
    Member since:
    Jul 2013

    Posted 01 Aug 2013 Link to this post

    In having to recreate the bug from scratch I discovered the source of the problem - a parent update panel.  In your solution, wrapping an UpdatePanel ContentTemplate around the RadComboBox causes the combobox to close after the postback.  How can I prevent this from occurring?

    My code is below. I have a checkbox that enables or disables the contents of one update panel.  The radcombobox has a single option that when selected enables a free text field.    

    <!--Checkbox enables or disables controls in UpdatePanel2 -->
        <asp:CheckBox ID="SharedCheck1" runat="server" Style="width: 40px;" AutoPostBack="True" OnCheckedChanged="SharedCheck1_OnCheckedChanged" Checked="False" CausesValidation="False" />
        <asp:UpdatePanel ID="UpdatePanel2" runat="server">
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="SharedCheck1" />
            </Triggers>
            <ContentTemplate>
                        <!--RaxComboBox enables or disables radtextbox in UpdatePanel3 -->
                        <telerik:RadComboBox ID="OtherFundingOrg1" runat="server" Width="210px" ReadOnlyStyle-CssClass="ReadOnlyStyle" AutoPostBack="True" OnItemChecked="OtherFundingOrg1_OnItemChecked"
                            DisabledStyle-CssClass="ReadOnlyStyle" ExpandDirection="Down" EnableScreenBoundaryDetection="false" CausesValidation="False" OnClientDropDownClosing="OnClientDropDownClosing"
                            DataTextField="Item2" DataValueField="Item1" CheckBoxes="true" Height="100px">
                            <ExpandAnimation Duration="150" Type="None" />
                            <CollapseAnimation Duration="150" Type="None" />
                        </telerik:RadComboBox>
     
                <asp:UpdatePanel runat="server" id="UpdatePanel3">
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="OtherFundingOrg1" />
                    </Triggers>
                    <ContentTemplate>
                                <telerik:RadTextBox ID="DescribeOther1" runat="server" Width="220px" MaxLength="800" ReadOnlyStyle-CssClass="ReadOnlyStyle" AutoPostBack="True" OnTextChanged="DescribeOther1_OnTextChanged" CausesValidation="False"
                                    DisabledStyle-CssClass="ReadOnlyStyle" TextMode="MultiLine" Height="67px">
                                </telerik:RadTextBox>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </ContentTemplate>
        </asp:UpdatePanel>

    I am willing to change my approach if I am doing it wrong, poorly, or in an ill-advised manner.  My main criteria here is to minimize redraws from postbacks.  

  5. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 06 Aug 2013 Link to this post

    Hello,

    Indeed the post-back is causing the RadComboBox to close when user checks/unchecks a specific item. One way to allow the customer to check/uncheck multiple items without closing the drop down list  is to use the RadComboBox OnTextChanged server-side event handler. That way the drop down list will remain open until user clicks outside of the input element or clicks on the tab key. In the event handler you are absolutely able to access all checked items and perform your custom logic.
    //code behind
    RadComboBox1.CheckedItems



    Regards,
    Boyan Dimitrov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top