Thursday, March 14, 2013

SharePoint List items in Modal Dialog Popup from CQWW or XSLT


         SharePoint List items in Modal Dialog Popup from  

                CQWP or XSLT


Open list items in Modal dialog listed in Content Query Web Part.  

Steps to do
  1. Open  Site with in SharePoint designer and go to All items > Style library> XSL Style Sheets.
  2. Open ItemStyle.xsl file and edit it (CheckOut \ take the backup for safe)
  3. Paste below section to any of the  </xsl:template>

 <xsl:template name="ModalDialogPopUp" match="Row[@Style='ModalDialogPopUp']" mode="itemstyle">
        <xsl:variable name="SafeLinkUrl">
            <xsl:call-template name="OuterTemplate.GetSafeLink">
                <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
            </xsl:call-template>
        </xsl:variable>
        <xsl:variable name="DisplayTitle">
            <xsl:call-template name="OuterTemplate.GetTitle">
                <xsl:with-param name="Title" select="@Title"/>
                <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
            </xsl:call-template>
        </xsl:variable>
        <div class="item link-item bullet">
            <xsl:call-template name="OuterTemplate.CallPresenceStatusIconTemplate"/>
            <a onclick="javascript:SP.UI.ModalDialog.ShowPopupDialog('{$SafeLinkUrl}'); return false;" onmouseover="javascript:this.style.cursor='hand';" title="{@LinkToolTip}">
                        <xsl:value-of select="$DisplayTitle"/>
            </a>
        </div>

    </xsl:template>  

4.      Save the file and check it in. 
5.      Edit CQWP, ==> Presents==> in the ItemStyle of CQWP Select from Dropdown as  ModalDialogPopUp and Click OK.



No comments:

Post a Comment