How to cal Radcomobobox OnClientItemsRequesting only in enter key press

6 posts, 0 answers
  1. Dhamodharan
    Dhamodharan avatar
    300 posts
    Member since:
    Sep 2010

    Posted 25 Nov 2014 Link to this post

    Hi All,

    I am using RadComboBox binding with webservice. so every letter typing webservice method search in database. this is fine when small amount of data. but in my side it is large amount of data. so i do not want search every letter typing. i want this searching only enter key press instead of every letter. i want to set AutoPostBack="true" also. please help me with this one. this is important and performance issue for me. Please help ASAP.


    Thanks in Advance,
    Dhamodharan
  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 28 Nov 2014 Link to this post

    Hello Dhamodharan,

    First you can use the RadComboBox MinFilterLenght that controls the minimum length of the typed text before the control initiates a request for new Items when EnableLoadOnDemand is True. If you set it to "3" the user have type at least 3 characters in the input field before the controls to initiates a request.

    Second you can remove the EnableLoadOnDemand="True" and request the items manually. In this approach you can request the items when user opens the drop down and when clicks "Enter".
    //markup code
    <script type="text/javascript">
        function OnClientKeyPressing(sender, args) {
            var e = args.get_domEvent();
            if (e.which != 13) {
                sender.requestItems(sender.get_text());
               }
        }
     
        function OnClientDropDownOpened(sender, args) {
            sender.requestItems(sender.get_text());
        }
    </script>
     
    <telerik:RadComboBox ID="RadComboBox4" runat="server" Width="250px" Height="150px" AllowCustomText="true"
        EmptyMessage="Select a Company" ShowMoreResultsBox="true"
        EnableVirtualScrolling="true" Label="Page Methods:">
        <WebServiceSettings Method="GetCompanyNames" Path="Default.aspx" />
    </telerik:RadComboBox>



    Regards,
    Boyan Dimitrov
    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
  4. Deepak
    Deepak avatar
    3 posts
    Member since:
    Mar 2013

    Posted 05 Dec 2014 Link to this post

    How do i insert an emptry string as the first entry to a radcomboxbox where i have used SQLdatasource and enableautomaticondemandload = true enablevirtualscrolling = true . please help
  5. Deepak
    Deepak avatar
    3 posts
    Member since:
    Mar 2013

    Posted 05 Dec 2014 Link to this post

    How do i insert an emptry string as the first entry to a radcomboxbox where i have used SQLdatasource and enableautomaticondemandload = true enablevirtualscrolling = true . please help
  6. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 10 Dec 2014 Link to this post

    Hello,

    Please use the RadComboBox ItemsRequestes event handler as shown below:
    //markup code
    <telerik:RadComboBox ID="RadComboBox1" runat="server" Width="250" Height="150"
                   EmptyMessage="Select a Company" DataSourceID="SqlDataSource1" DataTextField="CompanyName"
                   DataValueField="CompanyName" EnableAutomaticLoadOnDemand="True" ItemsPerRequest="10" AppendDataBoundItems="true" OnItemsRequested="RadComboBox1_ItemsRequested"
                   ShowMoreResultsBox="true" EnableVirtualScrolling="true" Label="Server-Side (Automatic):">
               </telerik:RadComboBox>

    //code behind
    protected void RadComboBox1_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
            {
                if (e.NumberOfItems <= 0)
                {
                    (sender as RadComboBox).Items.Insert(0, new RadComboBoxItem() { Text="" });
                }
            }


    Regards,
    Boyan Dimitrov
    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.

     
  7. Deepak
    Deepak avatar
    3 posts
    Member since:
    Mar 2013

    Posted 10 Dec 2014 in reply to Boyan Dimitrov Link to this post

    Thanks but wot i did was that i had sqldatasource so i returned the dataset with first entry as null value so that way my condition is satisfied!!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017