Adding Code to SharePoint pages using the Page Viewer Webpart

As I have mentioned before, my team and I are working on redesigning our corporate intranet in SharePoint. Our programmers are learning .Net and have been getting comfortable coding in it and creating applications. They haven’t really taken the time to figure out how to code within SharePoint though, and this leaves us with a problem. There was a lot of custom code on our old intranet and SharePoint doesn’t have an out-of-the-box solution for everything. My programmer started looking into creating a custom webpart but decided it was a pain and due to time constraints, we came up with an easy solution that works quite well.

He created a .net page with the necessary code for the widget and we pulled the code into the Sharepoint page using the Page Viewer webpart. We currently have two of these on our home page. One randomly loads a different slideshow image that upon clicking the image launches a slideshow in a popup window. The other loads stock quote data that is pulled from a web service.

I’m sure that hard-core programmers and SharePoint developers will weep at this hack, but for a small team with limited resources and time, this works quite well for us and was way easier to implement than a custom webpart. I have also used the page viewer webpart to pull in a Google map. On our old intanet, I was able to add the iframe code that Google Maps generates, but SharePoint seems to hate iframes and wont render them, so the page viewer webpart was a decent workaround here as well.

5 Comments »

  1. andyburns said

    I don’t know, that seems quite a reasonable solution.

    We have a sister company who produce a package for doing statistical process control – i.e. LOTS of graphs of how things are performing. It’s written in Java, and we wanted to ‘integrate’ this with SharePoint. We could’ve ended up with massive rewrites, but actually showing it through the Page Viewer web part gave a pretty good result in about 5 minutes.

    Why spend weeks reinventing the wheel?

  2. How did you get the pop windows to work from within the IFRAME (page viewer web part). I tried that a while back and the popups were “trapped” within the IFRAME..

    • mpakron said

      I’ll ask the programmer on Monday. I know for the slideshow, all the code is .net, resides on another server, and the javascript to open a new window is all included on the .apsx page we are pulling in.

      • mpakron said

        Talked to the programmer, he said: the image is wrapped in a hyperlink that calls a javascript function that creates a new window object

RSS feed for comments on this post · TrackBack URI

Leave a Comment