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

stop running this script

1 Answer 81 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Subbaraya Prabu
Top achievements
Rank 1
Subbaraya Prabu asked on 02 Sep 2011, 04:21 AM
Hi 

I am trying to use the  Telerik ComboBox control and  it keeps throwing me "stop running this script". This happens whenever I select  the item from the  dropdown or while typing and  changing on the  combo inputbox. I have  read the  performance optimization telerik web article but that has not helped me in anyway. At any given  time the  number of combo items could be around 1500 - 2000. 

I have added the  Telerik RadComboBox control as below, 

 <telerik:RadComboBox ID="radComboCityNames" runat="server"  EnableLoadOnDemand="true" OnClientBlur="" OnClientFocus=""
   OnClientItemsRequesting = "StopRequest" onitemsrequested="radComboCityNames_ItemsRequested" skin="Default" 
   MarkFirstMatch="false" AutoPostBack="false" EnableItemCaching="true"  EnableEmbeddedScripts="false" EnableViewState = "false">
 </telerik:RadComboBox>

And on the  ItemsRequested handler I have  coded as follows, 


RadComboBox combobox = (RadComboBox)sender; 
string text = string.Format("{0}%", e.Text);


DataTable dat = dt.GetCityNamesTable(1, text);
combobox.DataTextField = "cityname";
combobox.DataSource = dat;
combobox.DataBind();

Script used ,

    function StopRequest(combobox) {
        var combo = $find("<%=radComboCityNames.ClientID  %>");
        if (combo.get_text().length < 1) {
            combo.hideDropDown();
            return false;
        }
        else {
            return true;
        }
    }

Your assistance is much appreciated. It seems may people have  raised this but none has got a proper solution.! :(

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimitar Terziev
Telerik team
answered on 07 Sep 2011, 12:12 PM
Hello Subbaraya,

Do you receive this error in particular browser or in all of them? Also please change you event handler function as following:
function StopRequest(sender, args) {
 
            if(sender.get_text().length < 1) {
                args.set_cancel(true);
                sender.hideDropDown();
            }              
        }


Kind regards,
Dimitar Terziev
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
ComboBox
Asked by
Subbaraya Prabu
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Share this question
or