Hello all,
I am using ComboBox with multi check box and Filter option. I would like to know how can I get text which i gave in input area (for filtering) in code behind.
For example, if i have a combobox which shows all the countries -> typed "Ge" input area. Then menu/option in the dropdown with filter accordingly.
Now my requirment is How will i get the string "Ge" in code behind (in any event) and i prefer to do this code behind rather JS.
I hope this makes sense and looking forward for its solution...
Thankz
5 Answers, 1 is accepted
You can access the text typed by the user in the input field in the RadComboBox TextChanged server-side event as shown below:
protected
void
RadComboBox1_TextChanged(
object
sender, EventArgs e)
{
string
text = (sender
as
RadComboBox).Text;
}
More information about this event and the conditions under which it fires is available in the TextChanged documentation article.
Regards,
Ivan Danchev
Telerik
Dear Admin,
Thank you very much for your reply.
I tried this one and unfortunately its not working. It gives the text of the first item in the list rather the text/string which I typed.
For example, if Australia is the first item in the dropdown, "(sender as RadComboBox).Text;" gives value 'Australia. I need to get the text i type in to filter the menu
Looking forward to hear from you soon.
Regards,
Hari
The typed text will be available in TextChanged event handler if you click outside the ComboBox or hit Enter as explained in the linked article. You can see a short video that demonstrates getting the typed text. If you select an item from the returned result after entering the text, this Item's Text will be returned in the handler.
Regards,
Ivan Danchev
Telerik
Dear Ivan,
Thank you very much for your support... It worked...
The missing part was """" AllowCustomText ="true" """"
Thank you once again
Regards,
Hari
I am glad it worked out at your end as well and you are now able to get the entered text.
Regards,
Ivan Danchev
Telerik