Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
add comment

3 Answers 3

up vote 0 down vote accepted

Maybe try this instead:

window.location = window.location;
share|improve this answer
    
This refreshes the page and the search result is lost. I had tried this option as well –  Ishan Jul 11 '12 at 4:41
add comment

Try this:

SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);

Call this instead of location.reload(true);

share|improve this answer
    
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 '12 at 5:42
    
I missed some part of the code. Check out the updated answer. –  Vardhaman Deshpande Jul 11 '12 at 10:23
    
This works perfectly for me, preserving column filters. Thank you. –  David Clarke Sep 5 '13 at 2:41
add comment

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
    };
    SP.UI.ModalDialog.showModalDialog(options)
}

function onCloseCallback(dialogResult, returnValue) {
    SP.UI.Notify.addNotification('Something has changed');
    SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);
}
share|improve this answer
    
yes i have done that options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback); –  Ishan Jul 11 '12 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. –  Stefan Bauer Jul 11 '12 at 12:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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