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

How to cal Radcomobobox OnClientItemsRequesting only in enter key press

5 Answers 29 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Dhamodharan
Top achievements
Rank 1
Dhamodharan asked on 25 Nov 2014, 12:39 PM
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

5 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 28 Nov 2014, 11:18 AM
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.

 
0
Deepak
Top achievements
Rank 1
answered on 05 Dec 2014, 05:49 PM
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
0
Deepak
Top achievements
Rank 1
answered on 05 Dec 2014, 05:50 PM
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
0
Boyan Dimitrov
Telerik team
answered on 10 Dec 2014, 05:20 PM
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.

 
0
Deepak
Top achievements
Rank 1
answered on 10 Dec 2014, 06:46 PM
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!!
Tags
ComboBox
Asked by
Dhamodharan
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Deepak
Top achievements
Rank 1
Share this question
or