0

I have an issue with records being deleted before a RadConfirm window pops up. I am calling the RadConfirm serverside based on whether my string id is null or not. Why are my records deleting before the pop up and not waiting for it to be confirmed? I have also tried putting the methods in the else block but same thing happens. I need the RadConfirm to popup before the records get deleted and delete the records if the user clicks ok on the RadConfirm.

I have found this link Confirm Before Executing Codebehind but its only basing it on confirming, as you can see by my code I am calling the RadAlert if they try deleting with nothing selected.

if (ids == null)
    {
        RadWindowManager1.RadAlert("No selected records to delete.", 330, 180, "No Records", "alertCallBackFn");            
    }
    else
    {
        RadWindowManager1.RadConfirm("", "refreshGrid", 300, 300, null, "My Confirm", "alertCallBackFn"); 
    }
    dal.DeleteBankStatements(ids);
    RadGrid2.Rebind();
Community
  • 1
  • 1
Chris
  • 2,953
  • 10
  • 48
  • 118

1 Answers1

0

Your second parameter of RadConfirm should be the function you're calling. If there isn't a valid callback function, a javascript error can be thrown and the dialog won't show. Your logic would continue without showing the dialog and delete the records.

Also looks like your seventh parameter is a function. This should be an image url if you are using one, otherwise leave it alone.

Look for javascript errors in your browser, step through your code to see if it's being called, reference the following API. If your RadAlert works, it must be the parameters you're putting in RadConfirm.

API Documentation: http://www.telerik.com/help/aspnet-ajax/window-dialogs-confirm.html

claydwg
  • 64
  • 1
  • 3
  • Also, make sure to break the server logic when yhou call the confirm, because it will show for the user only when the page loads back in the browser, so you should initiate a second postback to actually delete: http://www.telerik.com/help/aspnet-ajax/window-using-radconfirm-in-server-code.html – rdmptn Nov 12 '14 at 12:03