Search code examples
c#asp.netloadpagemethodsmaster-pages

Load a page with pagemethods inside a div tag inside a MasterPage


I have a MasterPage which will appear in every page in the application and I'm trying to load a "LoginBox" which uses PageMethods inside a Div tag in this MasterPage

So far I have tried doing as I would do on a Content Page, tried converting it into a User Control and tried using a server side include (< !--#include file="LoginBox.aspx"-->) None succeeded.

I can see with firebug that the webresources get loaded but the PageMethods javascript isn't created in any of those methods.

I am REALLY trying to avoid having to create a WebService for this, and moving the LoginBox is not an option, I would rather drop the MasterPage idea, but then maintenance would become hell.

I need ideas or a direction on this. Any help is appreciated


Solution

  • I got it working successfully with an iframe loaded from javascript, to me it's an ugly solution, but still one. I'm open for better solutions

    <script type="text/javascript"> 
        (function () {
            var e = document.createElement('iframe');
            e.setAttribute("src", "LoginBox.aspx");
            e.setAttribute("scrolling", "no");
            e.setAttribute("frameborder", "0");
            e.setAttribute("height", "73px");
            e.setAttribute("width", "225px");
            e.setAttribute("marginheight", "0px");
            e.setAttribute("marginwidth", "0px");
            e.async = true;
            document.getElementById('loginboxd').appendChild(e);
        } ());
    </script>