Is it possible to get the selected item in OnSelectedIndexChanged?

2 posts, 0 answers
  1. Max
    Max avatar
    20 posts
    Member since:
    Apr 2016

    Posted 16 Jun 2016 Link to this post

    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?
  2. Ivan Danchev
    Ivan Danchev avatar
    1268 posts

    Posted 20 Jun 2016 Link to this post

    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.

    Ivan Danchev
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top