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

Getting RadAutoCompleteBox from TokenValidating event

3 Answers 137 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Rafael
Top achievements
Rank 1
Rafael asked on 07 Apr 2014, 08:16 PM
Hi,

How could I get the RadAutoCompleteBox  in TokenValidating event? The sender is an AutoCompleteBoxViewElement....
Thank you.

3 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 10 Apr 2014, 12:37 PM
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.

 
0
Rafael
Top achievements
Rank 1
answered on 11 Apr 2014, 10:48 AM
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.
0
Dimitar
Telerik team
answered on 16 Apr 2014, 07:36 AM
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.

 
Tags
AutoCompleteBox
Asked by
Rafael
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Rafael
Top achievements
Rank 1
Share this question
or