Comobo hideDropDown and show

2 posts, 0 answers
  1. mohamed
    mohamed avatar
    311 posts
    Member since:
    Mar 2011

    Posted 25 Sep 2011 Link to this post


    This Dropdown in inside editformsettings

    If down arrow is press at time only dropdown show other wise don't show,

    That function combo box id not get there



    <telerik:RadComboBox ID="Radcombo_Type" runat="server" Skin="Vista" Width="80%" SelectedValue='<%# Bind("datatype") %>'
                                                               MaxLength="6" OnClientDropDownOpening="HandleOpen"  >
                                                               <Items>
                                                                   <telerik:RadComboBoxItem runat="server" Text="Client" Value="Client" />
                                                                   <telerik:RadComboBoxItem runat="server" Text="Main Contractor" Value="ManCon" />
                                                                   <telerik:RadComboBoxItem runat="server" Text="Sub Contractor" Value="SubCon" />
                                                                   <telerik:RadComboBoxItem runat="server" Text="Supplier" Value="Supler" />
                                                                   <telerik:RadComboBoxItem runat="server" Text="Consultant" Value="Consul" />
                                                                   <telerik:RadComboBoxItem runat="server" Text="Service Provider" Value="SerPro" />
                                                               </Items>
                                                           </telerik:RadComboBox>



    function HandleOpen(sender, args) {
                    debugger;
                    var combo = (sender.id);
                    var key = window.event.keyCode;
                    if (key == 40) {//backspace
                        args.set_cancel(true);
                        combo.showDropDown();
                    }
                    else {
                        combo.hideDropDown();
                        args.set_cancel(false);
                    }
     
                }

    Reply as soon as possible

    Thanks,
    Mohamed.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 26 Sep 2011 Link to this post

    Hi Mohamed,

    I am not quite sure about your actual requirement.
    Also I have found some mistakes in your code and I corrected that.
    Please elaborate your scenario if it doesn't help.

    JavaScript
    <script type="text/javascript" language="javascript">
        function HandleOpen(sender, args)
         {
            var combo = (sender.get_id());
            var key = window.event.keyCode;
            if (key == 40)
            {
                args.set_cancel(true);
                sender.showDropDown();
            }
            else
            {
                sender.hideDropDown();
                args.set_cancel(false);
            }
        }
    </script>

    Also take a look into the following help article for more on ComboBox client side API
    http://www.telerik.com/help/aspnet-ajax/combobox-client-side-basics.html

    Thanks
    Princy.
Back to Top