I have a Webpage in which two webparts are installed. This is a system wherin user can make holiday request and manager can approve or reject.

In 1st webpart The holiday requested by a user is shown in the gridview in a Pending state (to a Manager). Manager than has to click on the entry reflected in the gridview which than opens a Modal Dialog and set the status to approved in order to accept the users request.

In 2nd webpart: It consists of a date filter i.e a from date and to date, a dropdown list consisting of all the employees, a search button and a gridview. In this webpart all the Approved request are shown. On page load the gridview is blank and no entry is displayed. The entries are shown in grid only on click of search button and as per search criteria.Once manager approves the request from 1st webpart, the entry is than reflected in this 2nd webpart.

Now my issue is, when I hit a Search button may be for for all employees or for a single employee or by using the date range than all the results are displayed in grid but when i try to open a modal dialog from 1st webpart and change the status to approved and click save i get an IE error as shown in below image. enter image description here

If i click retry than everything works fine but if i press cancel than the approved state of the request is not reflected.

I want to get rid of this IE error message either by somehow displaying a custom error message or any other way, but it should keep the search results in the grid.

I have done location.reload(true); on click of save in modal pop up. This shows IE error, I also tried SP.UI.ModalDialog.RefreshPage(DialogResult.OK); but this does not refresh the page.

Please guide me how to go away with the error message.

  • Your SP.UI.ModalDialog.RefreshPage(DialogResult.OK); is wrong. It should be SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);. Also, make sure you have a reference to the sp.ui.dialog.js file which is located at /_layouts/15/sp.ui.dialog.js in the site collection.
    – Mihail
    Oct 24, 2015 at 18:15
  • any solution to this?
    – Rohit
    Feb 21, 2016 at 7:04

3 Answers 3


Maybe try this instead:

window.location = window.location;
  • This refreshes the page and the search result is lost. I had tried this option as well
    – Ishan
    Jul 11, 2012 at 4:41

Try this:


Call this instead of location.reload(true);

  • function CloseCallback(result, target) { SP.UI.ModalDialog.RefreshPage(DialogResult.OK); //SP.UI.ModalDialog.RefreshPage(result.OK); } i tried this but this does not refresh a page. once modal is closed there is no refresh
    – Ishan
    Jul 11, 2012 at 5:42
  • I missed some part of the code. Check out the updated answer. Jul 11, 2012 at 10:23
  • This works perfectly for me, preserving column filters. Thank you. Sep 5, 2013 at 2:41

Are you sure that you have registered the dialogReturnValueCallback, when you open the dialog?

function openModalDialog(targetUrl) {
    var options = {
        url: targetUrl,
        title: 'Your Dialog',
        allowMaximize: true,
        showClose: true,
        width: 800,
        height: 600,
        dialogReturnValueCallback: onCloseCallback

function onCloseCallback(dialogResult, returnValue) {
    SP.UI.Notify.addNotification('Something has changed');
  • yes i have done that options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback);
    – Ishan
    Jul 11, 2012 at 12:40
  • And i think this is the problem with your code. Define it the same way as i did and i bet i would work. It's also more cleaner code than add directly the function. Jul 11, 2012 at 12:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.