RadDropDownList event handlers returning RadDropDownListElement object

1 Answer 39 Views
ColorBox DropDownList
Hayley
Top achievements
Rank 1
Iron
Hayley asked on 07 May 2024, 06:16 AM

Hello,

I'm using a RadDropDownList control and i've noticed when handling the PopupOpening event, the sender object being passed is a RadDropDownListElement object and not the RadDropDownList control itself. Is there a way to get the RadDropDownList object from the RadDropDownListElement object? I need to get the parent control of the actual RadDropDownList control and i can't do this from the RadDropDownListElement object currently. 

I have the same problem with the RadColorBox and its ValueChanged event handler returning a RadColorBoxElement object instead of RadColorBox.

Let me know if you need more information!

Thanks,

Hayley

1 Answer, 1 is accepted

Sort by
0
Accepted
Dinko | Tech Support Engineer
Telerik team
answered on 09 May 2024, 09:49 AM

Hello Hayley,

Thank you for reaching out to us.

You can get control from the ElementTree property. Here is how you can do that.

private void RadDropDownList1_PopupOpening(object sender, CancelEventArgs e)
{
    var element = sender as RadDropDownListElement;
    if (element != null)
    {
        var control = element.ElementTree.Control as RadDropDownList;
    }
}

You can try the same for the RadColorBox control. If you encounter a scenario in which the ElementTree.Control property is null, you can share it and I will try to find a suitable solution for you.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Hayley
Top achievements
Rank 1
Iron
commented on 10 May 2024, 03:02 AM

Thanks Dinko,

This is working for both RadColorBox and RadDropDownList!

Tags
ColorBox DropDownList
Asked by
Hayley
Top achievements
Rank 1
Iron
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or