ListBox OnClientSelectedIndexChanging eventArgs is set to cancel stopping other server side button's ButtonClick server side event on IE 9/10

1 posts, 0 answers
  1. Yogesh
    Yogesh avatar
    5 posts
    Member since:
    Apr 2011

    Posted 09 Jul 2013 Link to this post

    Hello There,

        I am working on RadControls for ASP.NET AJAX 2013.
        I am using the RadListBox with client side event OnClientSelectedIndexChanging for user confirmation box with two buttons on the page, one is save button and other cancel button with some textbox.
        If the user has made some changes in the textboxes, I pop-out the confirmation box (ok/cancel) to user.
        If user clicks on ok button, I call "Save" button event using the jquery.
        If user clicks on cancel button, I call "Cancel" button event using jquery.
        The code I am using at javascript is as follows :

    OnClientSelectedIndexChanging(sender, eventArgs) {
    // isUserInformationChanged is a local variable used for the data validation
    if(isUserInformationChanged){
        if (confirm("Do you want to save changes")) {
                        $($("#btnSave")).click();
            }
            else{
                $($("#btnCancel")).click();
            }
        }
    }


        This works for me on Firefox/Chrome. But, when I try this same code on IE 9/10, it not only gives call to my Save/Cancel button click but also gives call to SelectionChanged event.
        So, I added following code to suppress the listbox server side event :

     
    OnClientSelectedIndexChanging(sender, eventArgs) {
     // isUserInformationChanged is a local variable used for the data validation
      if(isUserInformationChanged){
         if (confirm("Do you want to save changes")) {
                         $($("#btnSave")).click();
             }
             else{
                 $($("#btnCancel")).click();
             }
         }
         eventArgs.set_cancel(true);
     }


        But, it just stopped raising both buttonClicked/OnSelectedIndexChanged events.
        So, I am confused why the ListBox control is raising the event even when the buttonClicked has been fired first and why ButtonClicked event is stopped raising if I am just suppressing the ListBox event OnSelectedIndexChanged.

         Can anyone please suggest me where I am getting it wrong. Any code may also be appreciated.

         Thanks in advanced.

    Thanks,
    Yogesh
Back to Top