locked
How to open popup dialog in standard edit for a document RRS feed

  • Question

  • Hi guys,

    I have a list of document in my web part with a button for edit the document's properties.

    I would like to open the standard dialog in edit for the document where the user click.

    How can I open that dialog box?

    tnx

    Thursday, July 26, 2012 1:38 PM

Answers

  • Hi Gaetanu,

    Every SharePoint List has 3 default Forms 

    1. Lists/{ListName}/Forms/DispForm.aspx -->View
    2. Lists/{ListName}/Forms/NewForm.aspx -->add
    3. Lists/{ListName}/Forms/EditForm.aspx -->update

    in the edit button add you need to add the javascript function below as onclick client event

    <script type="text/javascript">
    function openForm(ListName,ID){
    var options = {
          title: 'Decoded Message',
          width: 400,
          height: 400,
          url: '/Lists/'+ListName'/EditForm?ID='+ID 
          }; 
    SP.UI.ModalDialog.showModalDialog(options);
    };
    
    </script>
     

    you will have to pass ItemId and List Name , this can be done in code behinde setting the onclick attribute of the button to be like below

    btnUpdate.Attributes.add("onclick","javascript:openForm('"+ListName+"','"+ItemID+"); return false;);


    Hope that helps Amr Fouad MCTS,MCPD sharePoint 2010


    • Edited by Amr FouadMVP Thursday, July 26, 2012 1:55 PM
    • Proposed as answer by Amr FouadMVP Thursday, July 26, 2012 2:08 PM
    • Marked as answer by Lhan Han Thursday, August 2, 2012 7:10 AM
    Thursday, July 26, 2012 1:55 PM
  • <a onclick="SP.UI.ModalDialog.showModalDialog({url: &#39;YourURL&amp;IsDlg=1&#39;, title: &#39;Your Title&#39;, allowMaximize: true,showClose: true});return false;">testLink</a>


    yaşamak bir eylemdir

    • Proposed as answer by Ilqar Alizade Wednesday, August 1, 2012 12:34 PM
    • Marked as answer by Lhan Han Thursday, August 2, 2012 7:10 AM
    Thursday, July 26, 2012 2:06 PM

All replies

  • Hi Gaetanu,

    Every SharePoint List has 3 default Forms 

    1. Lists/{ListName}/Forms/DispForm.aspx -->View
    2. Lists/{ListName}/Forms/NewForm.aspx -->add
    3. Lists/{ListName}/Forms/EditForm.aspx -->update

    in the edit button add you need to add the javascript function below as onclick client event

    <script type="text/javascript">
    function openForm(ListName,ID){
    var options = {
          title: 'Decoded Message',
          width: 400,
          height: 400,
          url: '/Lists/'+ListName'/EditForm?ID='+ID 
          }; 
    SP.UI.ModalDialog.showModalDialog(options);
    };
    
    </script>
     

    you will have to pass ItemId and List Name , this can be done in code behinde setting the onclick attribute of the button to be like below

    btnUpdate.Attributes.add("onclick","javascript:openForm('"+ListName+"','"+ItemID+"); return false;);


    Hope that helps Amr Fouad MCTS,MCPD sharePoint 2010


    • Edited by Amr FouadMVP Thursday, July 26, 2012 1:55 PM
    • Proposed as answer by Amr FouadMVP Thursday, July 26, 2012 2:08 PM
    • Marked as answer by Lhan Han Thursday, August 2, 2012 7:10 AM
    Thursday, July 26, 2012 1:55 PM
  • <a onclick="SP.UI.ModalDialog.showModalDialog({url: &#39;YourURL&amp;IsDlg=1&#39;, title: &#39;Your Title&#39;, allowMaximize: true,showClose: true});return false;">testLink</a>


    yaşamak bir eylemdir

    • Proposed as answer by Ilqar Alizade Wednesday, August 1, 2012 12:34 PM
    • Marked as answer by Lhan Han Thursday, August 2, 2012 7:10 AM
    Thursday, July 26, 2012 2:06 PM