RadDropDownList : Prevent popup close on certain value

2 posts, 0 answers
  1. QuizzBox
    QuizzBox avatar
    93 posts
    Member since:
    Jan 2011

    Posted 05 Mar 2019 Link to this post


    Is there a way to prevent the popup closing when i select a certain value ?

    On PopupClosing event, with args=true, i can cancel event but the selectValue return the old value, not the new selected.

    Thanks in advance ;)

  2. Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    4170 posts

    Posted 06 Mar 2019 Link to this post

    Hello, Jean-Marc,    
    Indeed, the PopupClosing event is the appropriate way to prevent closing the popup in certain conditions. Indeed, the new value is committed when the popup is closed. 

    However, I can suggest you to handle the Popup.MouseDown event and detect which item was clicked and use this information in the PopupClosing event. Please refer to the following code snippet:
    bool cancel = false;
    public RadForm1()
        this.radDropDownList1.PopupClosing += radDropDownList1_PopupClosing;
        this.radDropDownList1.PopupOpened += radDropDownList1_PopupOpened;
        this.radDropDownList1.Popup.MouseDown += Popup_MouseDown;
    private void Popup_MouseDown(object sender, MouseEventArgs e)
        RadListVisualItem visualItem = this.radDropDownList1.Popup.ElementTree.GetElementAtPoint(e.Location) as RadListVisualItem;
        if (visualItem != null && visualItem.Data.Text.Contains("4"))
            cancel = true;
            cancel = false;
    private void radDropDownList1_PopupOpened(object sender, EventArgs e)
        cancel = false;
    private void radDropDownList1_PopupClosing(object sender, Telerik.WinControls.UI.RadPopupClosingEventArgs args)
        args.Cancel = cancel;

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top