Getting RadAutoCompleteBox from TokenValidating event

4 posts, 0 answers
  1. Rafael
    Rafael avatar
    12 posts
    Member since:
    Jan 2011

    Posted 07 Apr 2014 Link to this post

    Hi,

    How could I get the RadAutoCompleteBox  in TokenValidating event? The sender is an AutoCompleteBoxViewElement....
    Thank you.
  2. Dimitar
    Admin
    Dimitar avatar
    1408 posts

    Posted 10 Apr 2014 Link to this post

    Hello Rafael,

    Thank you for  contacting us.

    In the general case the RadAutoCompleteBox should be defined in the same class as its TokenValidating event handler, which means that you can access it directly. Also you can use the view element parent which is the default RadAutoCompleteBoxElement that is used by the control and most of its properties can be accessed through it:
    void radAutoCompleteBox1_TokenValidating(object sender, Telerik.WinControls.UI.TokenValidatingEventArgs e)
    {
        AutoCompleteBoxViewElement viewElement = sender as AutoCompleteBoxViewElement;
        RadAutoCompleteBoxElement element = viewElement.Parent as RadAutoCompleteBoxElement;
     
        radAutoCompleteBox1.AccessibleDescription = "Description";
    }

    Detailed information about our controls structure can be found in the following help section: Overview.

    I hope this information helps. Should you have any other questions, I will be glad to assist you.

    Regards,
    Dimitar
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Rafael
    Rafael avatar
    12 posts
    Member since:
    Jan 2011

    Posted 11 Apr 2014 in reply to Dimitar Link to this post

    On this way, I can not use the same sub to handle 2 differents ACB only cheking SENDER ?
    I need to change the text property of both of them when each one gets a new valid token.
  5. Dimitar
    Admin
    Dimitar avatar
    1408 posts

    Posted 16 Apr 2014 Link to this post

    Hello Rafael,

    Thank you for writing back.

    In this case you can use the Text property of the element, which references the same property of the control:
    void radAutoCompleteBox1_TokenValidating(object sender, Telerik.WinControls.UI.TokenValidatingEventArgs e)
    {
        AutoCompleteBoxViewElement viewElement = sender as AutoCompleteBoxViewElement;
        RadAutoCompleteBoxElement element = viewElement.Parent as RadAutoCompleteBoxElement;
        element.Text = "Test";
    }

    This way you will be able to use this handler with more than one auto complete box.

    I hope this helps. Should you have any other questions do not hesitate to ask.

    Regards,
    Dimitar
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top