selected index not working when use editable combobox

2 posts, 0 answers
  1. Jiju
    Jiju avatar
    57 posts
    Member since:
    Jul 2011

    Posted 11 Nov 2014 Link to this post

    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,
  2. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 14 Nov 2014 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top