locked
Displaying Performance Point Dashboard and Reports in Asp.Net Web Site RRS feed

  • Question

  • Hi

    I am new to Performance point and Share point and I have a requirement where I need to display Performance point Dashboards and Reports that are deployed on Sharepoint in my Asp. Net website.

    Could any one please guide me that how can i go about this.

    Thanks Kunal.
    Thursday, April 30, 2009 4:55 AM

All replies

  • You can reference the URL location of the dashboard page that is deployed to the SharePoint document library.  The dashboard viewer web part is only useable in SharePoint to the best of my knowledge to leverage PerformancePoint.
    Dan English's BI Blog
    _____________________________________________________
    Please mark posts as answer or helpful when they are.
    Thursday, April 30, 2009 12:27 PM
  • Kunal,

    Yes, PerformancePoint Server 2007 dashboards can be used on a ASP.net web page. The easiest way to do this is to create a dashboard and deploy as a preview web site. The dashboard will be deployed to the preview web folder as a simple ASP.net page. Copy this page and use it as the starting point for your custom ASP.net page.

    WARNING - I would be very careful using this workaround if migrating to PPS2010 is a requirement. Some architectural changes discussed by MS will break this if they are in the released project. Since this is a workaround and not primary functionality it will not be on any test plans for migration. Use with caution.

    However if you need a quick and simple way to create a custom BI application using MS components that should be supported for at least 3 more years, then this can be a very useful trick.

    -Peter Sprague
    Thursday, April 30, 2009 4:27 PM
  • I don't believe just a straight copy-and-paste is going to work since the Preview site is configured to use the PPS web part and all of the web.config settings and references for PPS.  Same holds true for what gets deployed to SharePoint.  You are going to need to reference the web pages that get deployed within your web application.  Maybe you have been able to find a way to modify the PPS web part to use outside of SharePoint.
    Dan English's BI Blog
    _____________________________________________________
    Please mark posts as answer or helpful when they are.
    Thursday, April 30, 2009 9:58 PM
  • Hi,
    I am using the following code trying to implement the same.

    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    using System.Web.UI.HtmlControls;
    using System.Collections;

    using Microsoft.PerformancePoint.Scorecards;
    using Microsoft.PerformancePoint.Scorecards.WebControls;
    using Microsoft.SharePoint;
    using System.Text;
    using Microsoft.PerformancePoint.Scorecards.WebParts;
    using Microsoft.SharePoint.WebPartPages;
    using System.IO;
    using Microsoft.SharePoint.WebControls;
    using System.Web.UI.WebControls.WebParts;


    public partial class _Default : System.Web.UI.Page
    {
        IBpm oService = null;

        protected void Page_Init(object sender, EventArgs e)
        {
            oService = PmService.CreateInstance("http://mitchellsql:40000/WebService/PmService.asmx");
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnTest_Click(object sender, EventArgs e)
        {
            DisplayDefaultScoreCard();
        }


        public void DisplayDefaultScoreCard()
        {
            DashboardCollection ds = oService.GetDashboards();
            Dashboard oDashboard = ds[0];

            DashboardElementContainer dbePage = (DashboardElementContainer)oDashboard.Pages[1];

            DashboardItem item = (DashboardItem)(((DashboardElementContainer)dbePage.DashboardElements[0]).DashboardElements[1]);

            DashboardItemWebPart diw = new DashboardItemWebPart();
            Random ran = new Random();
            diw.ID = ran.Next().ToString();
            diw.Title = "Test";
            diw.DashboardId = oDashboard.Guid.ToString();
            diw.ItemIds = item.Guid.ToString();


            SPSite site = new SPSite("http://SharePointServer/WebSite/Dashboard/ReportPage.aspx");
            if (site != null)
            {
                SPWeb web = site.OpenWeb();
                if (web != null)
                {

                    web.DocTemplates.ToString();
                    SPLimitedWebPartManager spLWM = web.GetLimitedWebPartManager("http://SharePointServer/WebSite/Dashboard/ReportPage.aspx", PersonalizationScope.User);
                    System.Web.UI.WebControls.WebParts.WebPart wpTemp = spLWM.WebParts[0];
                    web.AllowUnsafeUpdates = true;
                    web.Update();

                    Microsoft.SharePoint.SPWebPartCollection col = web.GetWebPartCollection("http://SharePointServer/WebSite/Dashboard/ReportPage.aspx", Storage.Shared);
                    WebPartManager1.AddWebPart(diw, Zone1, 0);
                    spLWM.AddWebPart(diw, Zone1.ID, 1);
                    web.Dispose();
                    wpTemp.Dispose();
                    site.Dispose();
                    diw.Dispose();

                }
                else
                {
                    Response.Write("Web Null");
                }
            }
            else
            {
                Response.Write("Site Null");
            }
        }
    }

    _________________________________________________________________________

    <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
    <%@ Register TagPrefix="PPSWebParts" Namespace="Microsoft.PerformancePoint.Scorecards.WebParts"   Assembly="Microsoft.PerformancePoint.Scorecards.WebParts, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" %>
    <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:Button ID="btnTest" runat="server" Text="Show" OnClick="btnTest_Click" />
            <PPSWebParts:ScriptManagerLoader ID="sm" runat="server" EnablePartialRendering="true"/>
            <WebPartPages:SPWebPartManager ID="WebPartManager1" runat="server" EnableClientScript="true"/>
            <WebPartPages:WebPartZone ID="Zone1" runat="server" Title="Zone" Height="85px" Width="268px">
                <ZoneTemplate>
                    <PPSWebParts:DashboardItemWebPart ID="dbiwpScorecard" runat="server"/>
                </ZoneTemplate>
            </WebPartPages:WebPartZone>
        </div>
        </form>
    </body>
    </html>

    _________________________________________________________________________________

    Firstly this gave me an error

    The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.

    To avoid this I went to Central Administration >Application management > Web Application General Settings >

    Web Page Security Validation


    and turned it off

    then i got another error:

    Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Runtime.InteropServices.COMException: Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))

    Source Error:

    Line 72:                 Storage str = Storage.Shared;
    Line 73: Microsoft.SharePoint.SPWebPartCollection col = web.GetWebPartCollection("http://mitchellsql/ReportCenterDemo/Test.aspx", str);
    Line 74: WebPartManager1.AddWebPart(col[0], Zone1, 0);

    Line 75:
    Line 76: spLWM.AddWebPart(diw, Zone1.ID, 1);

    Source File: d:\Kunal\Default.aspx.cs    Line: 74

    Stack Trace:

    [COMException (0x80020009): Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))]
    Microsoft.SharePoint.Library.SPRequestInternalClass.AddWebPart(String bstrWebUrl, Boolean fAllUsers, String bstrID, String bstrWebPartTypeID, Boolean fIsIncluded, Byte bFrameState, String bstrZoneID, Int32 lPartOrder, Byte[]& ppsaAllUsersProperties, Byte[]& ppsaPerUserProperties, String[]& ppsaLinks) +0
    Microsoft.SharePoint.Library.SPRequest.AddWebPart(String bstrWebUrl, Boolean fAllUsers, String bstrID, String bstrWebPartTypeID, Boolean fIsIncluded, Byte bFrameState, String bstrZoneID, Int32 lPartOrder, Byte[]& ppsaAllUsersProperties, Byte[]& ppsaPerUserProperties, String[]& ppsaLinks) +147

    [SPException: Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))]
    Microsoft.SharePoint.Library.SPRequest.AddWebPart(String bstrWebUrl, Boolean fAllUsers, String bstrID, String bstrWebPartTypeID, Boolean fIsIncluded, Byte bFrameState, String bstrZoneID, Int32 lPartOrder, Byte[]& ppsaAllUsersProperties, Byte[]& ppsaPerUserProperties, String[]& ppsaLinks) +195
    Microsoft.SharePoint.WebPartPages.SPWebPartManager.AddWebPartToStore(WebPart webPart, Int32 viewId, String viewGuid) +900
    Microsoft.SharePoint.WebPartPages.SPWebPartManager.OnWebPartAdding(WebPartAddingEventArgs eventArgs) +136
    System.Web.UI.WebControls.WebParts.WebPartManager.AddWebPart(WebPart webPart, WebPartZoneBase zone, Int32 zoneIndex) +166
    _Default.DisplayDefaultScoreCard() in d:\Kunal\Default.aspx.cs:74
    _Default.btnTest_Click(Object sender, EventArgs e) in d:\Kunal\Default.aspx.cs:39
    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565


    Version Information:  Microsoft .NET Framework Version:2.0.50727.3082; ASP.NET Version:2.0.50727.3082


    Is there any work around for this error.
    It seems i am quiet near to my requirement.

    Thanks

    Kunal...
    Friday, May 1, 2009 3:57 AM
  • Kunal,

    Have you found any success?
    Thanks & Regards Sridhar
    Wednesday, June 10, 2009 12:54 PM