This is a migrated thread and some comments may be shown as answers.

RadMaskedEditBox Name from KeyUp Handler

1 Answer 64 Views
MaskedEditBox
This is a migrated thread and some comments may be shown as answers.
Nadia Sangiovanni
Top achievements
Rank 1
Nadia Sangiovanni asked on 11 Dec 2012, 09:04 PM
Hi Support,

I have 10 RadMaskedEditBox that use the same event handler on the KeyUp event. In my handler I need to know the name of the component it was called from.

private void radMaskedEditBox_KeyUp(object sender, KeyEventArgs e)
...

I would like to use something like that ((RadMaskedEditBox)sender).Name but it's not working since the sender is from type RadMaskedEditBoxElement and the Name property is empty.

How can I found the sender component name from the KeyUp event?

Regards,
Nadia

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 14 Dec 2012, 09:51 AM
Hello Nadia,

Thank you for the question.

You can use get the Name property from the ElementTree in this case. Please consider the following example:

private void radMaskedEditBox_KeyUp(object sender, KeyEventArgs e)
{
    if(((RadMaskedEditBoxElement )sender).ElementTree.Control.Name=="radMaskedEditBox2")
    {
 
    }
}

I hope this helps. Regards,
Peter
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Tags
MaskedEditBox
Asked by
Nadia Sangiovanni
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or