Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamically load and render cshtml files and return in controller as html
    primarykey
    data
    text
    <p>I'm working on a large scale software which consists of about 300 projects written in C#. The software is working based on a framework and a WinForm based portal for UI.</p> <p>Our team is working to develop the Web portal framework.</p> <p>The web portal is going to load and return javascript, cshtml and css files which resides in various dlls. For example:</p> <p><strong>Carane.Accounting.Web:</strong></p> <ul> <li>VoucherSmartPart.cshtml</li> <li>VoucherSmartPart.js</li> </ul> <p><strong>Carane.Inventory.Web:</strong></p> <ul> <li>GoodRequest.cshtml</li> <li>GoodRequest.js</li> </ul> <p>The framework resides in somewhere like <strong>Carane.Portal.Web</strong>.</p> <p>As the portal is SPA using HotTowel, I configured <code>Durandal</code> to get <code>html</code> views and javascript <code>viewmodels</code> from a Controller.</p> <p>The controller to return Javascript files works fine.</p> <p>The problem is with the ViewController which should be like this:</p> <pre><code>public class ViewController : ApiController { [HttpGet] public string GetSmartPart(string moduleName, string smartpartName) { // some code to retrieve the cshtml file from the dll // and render the cshtml and return the html in a way // as Durandal recognize it as a html file. } } </code></pre> <p><strong>Questions:</strong></p> <ol> <li>How to get <code>cshtml</code> files from another project to involve in framework project?</li> <li>How to render the <code>cshtml</code> and return it as a html.</li> </ol> <p>It's important that the cshtml file should be <strong>debug-able</strong> via Visual Studio while it's getting rendered.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload