Search code examples
headervisual-studio-lightswitch

Custom header in each page of LightSwitch


Can someone help me in adding a custom image/header (a html file containing titles, images and links) in each page of LightSwitch!


Solution

  • I did it by loading an HTML file as a fixed header as shown below in the default.htm file,

    Before,

       <script type="text/javascript">
            $(document).ready(function () {
                msls._run()
                .then(null, function failure(error) {
                    alert(error);
                });
            });
       </script>
    

    After,

    <script type="text/javascript">
            $(document).ready(function () {
                $.get("PartialViews/header.htm", function (response) {
                    var logfile = response;
                    document.body.insertAdjacentHTML("afterBegin", logfile);
                    msls._run()
                    .then(null, function failure(error) {
                        alert(error);
                    });
                });
            });
     </script>
    

    The header.htm file contains the fixed titles, images and links.