Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC render PartialViewResult to string
    primarykey
    data
    text
    <p>Disclaimer: I edited the question because i changed the process, but it does not change anything of the problem... </p> <p>I am trying to get a <code>PartialViewResult</code> rendered to a string, i tried to use the <code>RenderRazorViewToString</code> Method from this question <a href="https://stackoverflow.com/questions/483091/render-a-view-as-a-string">render a view as a string</a>..., i got the hint from this qustion <a href="https://stackoverflow.com/questions/4730777/mvc-return-partial-view-as-json">mvc return partial view as json</a></p> <p>My problem is, the string looks like this:</p> <pre><code>&lt;$A$&gt;&lt;h1&gt;SomeHeader&lt;/h1&gt; &lt;table&lt;/$A$&gt;&lt;$B$&gt; class="table table-striped"&lt;/$B$&gt;&lt;$C$&gt;&gt; &lt;tbody&lt;/$C$&gt;&lt;$D$&gt; data-bind="template: { name: 'eventTemplate', foreach: events }"&lt;/$D$&gt;&lt;$E$&gt;&gt;&lt;/tbody&gt; &lt;/table&gt;&lt;/$E$&gt; </code></pre> <p>instead of this</p> <pre><code>&lt;h1&gt;SomeHeader&lt;/h1&gt; &lt;table class="table table-striped"&gt; &lt;tbody data-bind="template: { name: 'eventTemplate', foreach: events }"&gt;&lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>Update:<br> The Process looks like this:</p> <pre><code>public ActionResult Index(string item, long id) { var cont = SomePartialView(item, id); return View(model: RenderRazorViewToString(cont)); } </code></pre> <p>now the View just renders the string like this:</p> <pre><code>@Model </code></pre> <p>The <code>RenderRazorViewToString(PartialViewResult)</code> returns this "crippled" string...</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.
 

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