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

Is it possible to get the selected item in OnSelectedIndexChanged?

1 Answer 108 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Max
Top achievements
Rank 1
Max asked on 16 Jun 2016, 09:56 PM
Hello, in my OnSelectedIndexChanged function I want to get some custom attributes from the item selected. ((RadComboBox)sender).SelectedItem is null and the event argument seems to only have the text and value properties available. Is there any way to do this?

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 20 Jun 2016, 07:27 AM
Hello Max,

If SelectedItem is null I assume you are loading the ComboBox on demand. As mentioned in this article the control's items do not exist on the server so you won't be able to access any of their attributes or the items themselves in the OnSelectedIndexChanged event handler. You could try saving the data you need in a hiddenfield, in the OnClientSelectedIndexChanged handler for example, and then access the hiddenfield on the server.

Regards,
Ivan Danchev
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
ComboBox
Asked by
Max
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or