combobox with checkboxes is giving a postback on close

4 posts, 0 answers
  1. Paul Evers
    Paul Evers avatar
    52 posts
    Member since:
    Oct 2011

    Posted 11 May 2015 Link to this post

    Hi,

    I have a RadComboBox with the checkboxes active. I want to have a postback for the ItemChecked event.

    The combobox also is generating a postback on closing of the dropdown which I do not want. How can I prevent this to happen.

    I have found a similar thread (http://www.telerik.com/forums/radcombobox-auto-post-back-issue) but the link to the solution presented there does not work anymore.

     

    Paul

  2. Aneliya Petkova
    Admin
    Aneliya Petkova avatar
    207 posts

    Posted 13 May 2015 Link to this post

    Hello Paul,

    Thank you for contacting us.

    The ItemChecked event does not fire unless the AutoPostBack property is True as well as CheckBoxes property. Please try the following example:
    .aspx:
    <form id="form1" runat="server">
        <asp:ScriptManager runat="server" />
        <div>
            <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1">
                <telerik:RadComboBox ID="RadComboBox1" runat="server" Skin="Silk" CheckBoxes="true" RenderMode="Classic"
                    AutoPostBack="true" EmptyMessage="Select" OnItemChecked="RadComboBox1_ItemChecked">
                    <Items>
                        <telerik:RadComboBoxItem Text="Arts" />
     
                        <telerik:RadComboBoxItem Text="Biographies" />
     
                        <telerik:RadComboBoxItem Text="Children's Books" />
     
                        <telerik:RadComboBoxItem Text="Computers & Internet" />
     
                        <telerik:RadComboBoxItem Text="Cooking" />
     
                        <telerik:RadComboBoxItem Text="History" />
     
                        <telerik:RadComboBoxItem Text="Fiction" />
     
                        <telerik:RadComboBoxItem Text="Mystery" />
     
                        <telerik:RadComboBoxItem Text="Nonfiction" />
     
                        <telerik:RadComboBoxItem Text="Romance" />
     
                        <telerik:RadComboBoxItem Text="Science Fiction" />
     
                        <telerik:RadComboBoxItem Text="Travel" />
                    </Items>
     
                </telerik:RadComboBox>
                <asp:Button Text="Do Postback" runat="server" />
                <br />
                <asp:Label ID="Label1" Text="" runat="server" />
            </telerik:RadAjaxPanel>
        </div>
    </form>

    aspx.cs:

    protected void RadComboBox1_ItemChecked(object sender, Telerik.Web.UI.RadComboBoxItemEventArgs e)
    {
        Label1.Text += e.Item.Text + "</br>";
    }

    More information about ItemChecked event, you may find in the following help article:
    http://www.telerik.com/help/aspnet-ajax/combobox-server-side-item-checked.html

    Hope this will be helpful. If you have further questions, please feel free to contact us again.

    Regards,
    Aneliya Petkova
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Paul Evers
    Paul Evers avatar
    52 posts
    Member since:
    Oct 2011

    Posted 13 May 2015 in reply to Aneliya Petkova Link to this post

    Hi Aneliya,

    The autopostback for the ItemChecked is not the issue. That is working fine. The issue is that besides a postback for the ItemChecked I get also a postback for closing (or leaving) the dropdown. This is undesirable. My question is how to prevent the last postback to happen without disturbing the postback for the ItemChecked.

    Regards,

    Paul

     

     

  5. Aneliya Petkova
    Admin
    Aneliya Petkova avatar
    207 posts

    Posted 13 May 2015 Link to this post

    Hi Paul,

    Did you try the example I showed you in my previous post? I made a video for you showing that no postback on closing or opening the dropdown is performed - only for checking the items in the RadComboBox. I tested using 2015 Q1 SP1 release.

    In order to help you, I will need to test and inspect your exact implementation of the RadComboBox. Also could you please confirm which version of Telerik UI for ASP.NET AJAX you are using?

    Regards,
    Aneliya Petkova
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top