Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1740
Stop running this script? and DropDownClosed event
posted

1) My WebDropDown has multi-select checkbox functionality with “Select All” feature implemented through the client-side SelectionChanged event.

 

2) Now if I implement the server-side OnSelectionChanged event by enabling the AutoPostBackFlags-SelectionChanged=”On”, on selecting an element I get a pop-up error saying “Stop running this script? A script on this page is causing Internet Explorer to run slowly. If it continues to run, your computer may become unresponsive.” Also the event gets fired after every selection whereas we want the event to execute only after all the selections are done and when the dropdown is closed.

 

3) I tried implementing this solution from the forum but it doesn’t help - http://community.infragistics.com/forums/t/32575.aspx

 

    <script type="text/javascript">

 

        function selectedIndexChanged(sender, eventArgs) {

            /*

*/

        }

 

        function dropDownClosed(sender, args) {

            var dd = sender._callbackManager.createCallbackObject();

            sender._callbackManager.execute(dd, true);

        }

 

    </script>

 

<ig:WebDropDown ID="WebDropDown1" runat="server" Width="200px" EnableMultipleSelection="True" EnableClosingDropDownOnSelect="False" OnSelectionChanged="WebDropDown1_SelectionChanged">

<ClientEvents SelectionChanged="selectedIndexChanged" DropDownClosed="dropDownClosed" />

</ig:WebDropDown>

 

This fires the server-side event after the selections are done and when the dropdown is closed but leaves the dropdown still open.

I will appreciate any help from the user community!

Parents
No Data
Reply
  • 24671
    Suggested Answer
    posted

    Hi,

    if you don't want to have a postback after every selection, then you shouldn't set AutoPostBackFlag to On or Async. It is not possible to cancel selection and have selection at once at the same time, once the list is closed.

    I suggest the following approach - keep your current code, but only remove the autopostback flags settings, so that there is no postback.

    In the DropDownClosed client-side event handler, do that:

        function dropDownClosed(sender, args) {

                var dd = sender._callbackManager.createCallbackObject();

                sender._callbackManager.execute(dd, true);

            }

    It's always good to also put a flag, so that in the closing handler, it knows when to do postback. I.e. do postback only when there was change in the selection. Otherwise it will do an async postback everytime the dropdown is closed. 

    If this doesn't help and the dropdown is still open, i would handle the Initialize client-side event, check whether the dropdown is open and if it is , close it, or just always close it by calling this function:

    dropDown.closeDropDown();

    Then the functions that you already have become like this:

     

        <script type="text/javascript">

          var selectionChanged = false;

            function selectedIndexChanged(sender, eventArgs) {

                   selectionChanged=true;

                /*

    */

            }

     

            function dropDownClosed(sender, args) {

                if (selectionChanged) 

               {

                        var dd = sender._callbackManager.createCallbackObject();

                        sender._callbackManager.execute(dd, true);

                        selectionChanged=false;

                }

            }

     

        </script>

    This should work fine, i don't know why it leaves the dropdown still open. Could you try and let me know whether it works? 

    Thanks,

    Angel 

Children