stop running this script

2 posts, 1 answers
  1. Subbaraya Prabu
    Subbaraya Prabu avatar
    3 posts
    Member since:
    Sep 2012

    Posted 01 Sep 2011 Link to this post

    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.! :(

  2. Answer
    Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 07 Sep 2011 Link to this post

    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 >>

Back to Top