Display List In Content Query Webpart


 
    <DIV id="ListPlaceholder"><IMG src="/_layouts/images/GEARS_AN.GIF"></DIV>
 
    <!-- Paste the URL of the source list below: -->
    <iframe id="SourceList" style="display:none;" src="/site/Lists/Calendar/Current%20Month%20Events.aspx" onload="DisplayThisList()"></iframe>
 
    <script type="text/javascript">
    function DisplayThisList()
    {
        var placeholder = document.getElementById("ListPlaceholder");
        var displaylist = null;
        var sourcelist = document.getElementById("SourceList");
        try {
               if(sourcelist.contentDocument)
                  // Firefox, Opera
                  {
                displaylist = sourcelist.contentDocument.getElementById("WebPartWPQ2") ;
            }
               else if(sourcelist.contentWindow)
                  // Internet Explorer
                  {
                displaylist = sourcelist.contentWindow.document.getElementById("WebPartWPQ2") ;
            }
               else if(sourcelist.document)
                  // Others?
                  {
                displaylist = sourcelist.document.getElementById("WebPartWPQ2") ;
            }
        }
        catch(err)
        {
            alert ("Loading failed");
        }
        var allDescendants = displaylist.getElementsByTagName("*");
        placeholder.innerHTML = displaylist.innerHTML;
    }
    </script>
 
 

Comments

Popular Posts

SharePoint Interview Questions and Answers

Download Infopath Form Templates

How to get current logged user information using JavaScript ?

Steps to set Form based authentication (FBA) for SharePoint 2010

SharePoint Interview Questions and Answers II

Get List Items - JavaScript

Cross Site List Rollup Web Part for SharePoint 2010

Hide Recently Modified Items

Change Language for current user with JSOM in SharePoint Online

SharePoint 2010 CSS Chart