Lost focus on RadComboBox after change selected index

5 posts, 0 answers
  1. Leonid Caceres
    Leonid Caceres avatar
    5 posts
    Member since:
    Jul 2013

    Posted 11 May 2015 Link to this post

    Hi, I'm developing an application and I can't lost the focus on a radcombobox after select an item in the Radcombobox to focus in other control (this example a textbox) by client javascript/jquery code. But in the image attached it seems the focus on both controls. I only want the focus on the textbox.

    My code:

    <rad:RadComboBox ID="cmbRegDep" Skin="MetroTouch" EnableEmbeddedSkins="true"   ShowDropDownOnTextboxClick="true" MarkFirstMatch="true"
    runat="server" Height="400px" Width="100%" DataValueField="depNo" DataTextField="depNo" EmptyMessage="Velg"  OnClientSelectedIndexChanged="onSelectedIndexChanging_cmbDep" 
    HighlightTemplatedItems="true" DropDownWidth="300px" OffsetX="0" Filter="Contains"  >
    <HeaderTemplate>
    <ul>
    <li class="col1H">Nr.</li>
    <li class="col2H">Beskrivelse</li>
    </ul>
    </HeaderTemplate>
    <ItemTemplate>
    <ul>
    <li class="col1"><%# DataBinder.Eval(Container.DataItem, "depNo") %></li>
    <li class="col2"><%# DataBinder.Eval(Container.DataItem, "depName") %></li>
    </ul>
    </ItemTemplate>
    </rad:RadComboBox>

        <asp:TextBox ID="txtDep" runat="server"></asp:TextBox>

    <script type="text/javascript">

        function onSelectedIndexChanging_cmbDep(sender, eventArgs) {
            document.getElementById('<%= txtDep.ClientID%>').focus();

        }
    </script>

  2. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 14 May 2015 Link to this post

    Hi Leonid,

    Combo has a collapse animation. Try to put small timeout to wait until it finishes:

    function onSelectedIndexChanging_cmbDep(sender, eventArgs) {
        setTimeout(function () {
            document.getElementById('<%= txtDep.ClientID%>').focus();
        }, 100);
    }

    Regards,
    Hristo Valyavicharski
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Leonid Caceres
    Leonid Caceres avatar
    5 posts
    Member since:
    Jul 2013

    Posted 19 May 2015 in reply to Hristo Valyavicharski Link to this post

    I've tried with this solution but it's still remaining a class style rcbFocused on the Radcombobox that only dissapear when I click with the mouse in other part of the page. An also the event (OnClientSelectedIndexChanged,OnClientSelectedIndexChanging) seems finish in that moment. Is there a way to change the focus in other control without leave something pending in the RadCombobox?
  5. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 20 May 2015 Link to this post

    You can remove this css class with jquery:

    function onSelectedIndexChanging_cmbDep(sender, args) {
                    $telerik.$(sender.get_element()).find('table').removeClass('rcbFocused');
                    setTimeout(function () {
                        document.getElementById('<%= txtDep.ClientID%>').focus();
                    }, 100);
                }


    Regards,
    Hristo Valyavicharski
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. Leonid Caceres
    Leonid Caceres avatar
    5 posts
    Member since:
    Jul 2013

    Posted 21 May 2015 Link to this post

    Thank you for show me how remove the css in the Radcombobox
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017