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

When I click manage permission button in ecb menu in a list a new user.aspx page is opened. I want to open this page in modal dialog. How can I do it? I know about msdn and this solutions, but the second doesn't work for me. I want to open user.aspx page in modal dialog only for one application page.

share|improve this question
add comment

2 Answers 2

This should get you going.

http://msdn.microsoft.com/en-us/library/ff410058.aspx

    //Using the DialogOptions class.
    var options = SP.UI.$create_DialogOptions();

    options.title = "My Dialog Title";
    options.width = 400;
    options.height = 600;
    options.url = "/_layouts/DialogPage.aspx";

SP.UI.ModalDialog.showModalDialog(options);

//Using a generic object.
var options = {
title: "My Dialog Title",
width: 400,
height: 600,
url: "/_layouts/DialogPage.aspx" };

SP.UI.ModalDialog.showModalDialog(options);

Here try this site http://kancharla-sharepoint.blogspot.com/2012/07/sharepoint-model-dialog-from-ribbon.html

    <!--?xml version="1.0" encoding="utf-8"?-->

  <commanduihandlers>
    <commanduihandler command="ShowAlert" commandaction="javascript:
                      function demoCallback(dialogResult, returnValue)
          {
            SP.UI.Notify.addNotification('Operation Successful!');

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

          var options = {             
            url: '/_layouts/Settings.aspx',
            tite: 'Move Documents',
            allowMaximize: false,
            showClose: true,
            width: 800,
            height: 600,
            dialogReturnValueCallback: demoCallback };

          SP.UI.ModalDialog.showModalDialog(options);">
  </commanduihandler></commanduihandlers>

share|improve this answer
    
Thank you the answer, but I know how to create model dialogs. I don't know how to open user.aspx page when clicking 'manage permission' item in Edit Control Block menu. This item is created dynamically in core.js. I am looking for the jquery solution or something else. –  andDaviD Oct 8 '12 at 15:15
    
Wow is there someway that you could get the id of the button after it is created and override the click event and produce the dialog yourself. –  Joseph D Surgeon Oct 8 '12 at 15:28
    
I believe you can use this blog to get you going. kancharla-sharepoint.blogspot.com/2012/07/… –  Joseph D Surgeon Oct 8 '12 at 15:31
    
I can't go to this link, i have a message: "Moved Temporarily The document has moved here". As for the second comment, I am trying to use jquery live() and attr() methods, but attr() method doesn't work. I can't recognize why. –  andDaviD Oct 8 '12 at 16:24
    
I know JQuery Live and attr will not work it is a known issue about how SP changes the ID's of elements. Try this link again kancharla-sharepoint.blogspot.com/2012/07/… also Please note that I am using a CommanduiHandler which is what you should be using to handle the click event of the custom button and within that event you should be able to call the user.aspx page within a dialog passing any required parameters. This is the easiest solution to keep from tracking id's using jquery –  Joseph D Surgeon Oct 8 '12 at 16:39
add comment

Here is how I have done it in the past:

1)Include a script on your page which will attach a custom "click" event on all the ECB buttons (the ones with the downward arrow image). The class you can use as selector for the ECB button is s4-ctx

2) Inside that custom event, write another function which will look for the "Manage Permissions" span with id as ID_MngPerms and change it's click event to open the modal dialog box with the permissions page inside.

The way this will work is that the ECB menu is loaded on the page only after the ECB button is clicked. So we will be able to get it using jQuery only after the click event of the ECB is fired.

Here is some starting code for you:

$(function(){
    //Attach custom click event to ECB buttons
    $(".s4-ctx").bind("click",function(){   
        //Remove any default function from the Manage Permissions link.
        $("#ID_MngPerms").unbind();
        //Attach custom function.
        $("#ID_MngPerms").bind("click",function(){
            //Open Modal Dialog box.
        }); 
    });
});
share|improve this answer
    
Thank you for your solution. But unbind method doesn't work. So, at first dialog box is loading and then it stops loading and microsoft's manage permission page is opened instead of mine. –  andDaviD Oct 9 '12 at 11:01
1  
you can use $("#ID_MngPerms").attr("onclick",null); instead of unbind –  Vardhaman Deshpande Oct 9 '12 at 13:00
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.