RadMaskedEditBox Name from KeyUp Handler

2 posts, 0 answers
  1. Nadia Sangiovanni
    Nadia Sangiovanni avatar
    38 posts
    Member since:
    Apr 2010

    Posted 11 Dec 2012 Link to this post

    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
  2. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 14 Dec 2012 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top