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

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

0 Answers 56 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Yogesh
Top achievements
Rank 1
Yogesh asked on 09 Jul 2013, 03:37 PM
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

No answers yet. Maybe you can help?

Tags
ListBox
Asked by
Yogesh
Top achievements
Rank 1
Share this question
or