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

selected index not working when use editable combobox

1 Answer 108 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jiju
Top achievements
Rank 1
Jiju asked on 11 Nov 2014, 03:11 PM
Hi,

I am using a rad combobox in my web page, as below

<telerik:RadComboBox ID="textboxCombo" AllowCustomText="true" runat="server"></telerik:RadComboBox>

when I just select the combobox value then I will get the selected index value, but when I select the value and then edit , then I am getting the selected index as -1, how can I get the selected index value even if I edit the selected value?

thanks,

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 14 Nov 2014, 12:15 PM
Hello Jijo,

In order to achieve the desired behavior, you can use a hidden field so you could store the last selected index and then access it when needed. Please consider the below implementation at the OnClientSelectedIndexChanged:

<script type="text/javascript">
        function OnClientSelectedIndexChanged(sender, args) {
            var index = sender.get_selectedIndex();
            if (index != null) {
                $get("hiddenField1").value = index;
            }
        }
    </script>

In addition, in the attachment, you could find an isolated sample page, where the above suggestion is implemented.


Regards,
Nencho
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
ComboBox
Asked by
Jiju
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Share this question
or