locked
Partial view

    Question

  • Can I create a partial view in html?

    I have a flyout that I want to use in multiple pages


    www.emadibrahim.com

    Sunday, July 01, 2012 4:53 PM

Answers

  • Hi

    Yes you can, WinJS.UI.Pages.render method will achieve this.

    Actually all the metro style sdk sample use this technique.

    You can download the code here:

    http://code.msdn.microsoft.com/windowsapps/Windows-8-Modern-Style-App-Samples

    1 create a new html for your flyout.

    2 In the html you want to use the partial view, declare a div.

    3 Use WinJS.UI.Pages.render(URL,targetelemet) to render the new html you create to this div element.

    Some thing like this:

     var targetElement = document.getElementById("itemDetailTarget");//itemDetailTarget is the div you declare.
    WinJS.Utilities.empty(targetElement);
    var url="/html/noSelection.html"//this is the html you created
     WinJS.UI.Pages.render(url, targetElement);

    Monday, July 02, 2012 7:46 AM