Reputation: 227
I'm trying to reuse my partial views like this:
<div>
<ul data-bind="foreach: DetailViewModelObject.ConfigsChild">
<li>
<table>
<tr>
<td colspan="5">
<input type="hidden" data-bind="value: DetailViewModelObject.Id" />
</td>
</tr>
<tr>
<td>
Llave
</td>
<td></td>
<td>
Valor
</td>
<td></td>
<td></td>
</tr>
<tr>
<td>
<input type="text" data-bind="value: DetailViewModelObject.Key" />
</td>
<td>
<input type="button" value="..." class="btn bg-primary" data-bind="click: DetailViewModelObject.SetPropertiesKeyCommand" style="margin: 5px" />
</td>
<td>
<input type="text" data-bind="value: DetailViewModelObject.Value" />
</td>
<td>
<input type="button" value="..." class="btn bg-primary" data-bind="click: DetailViewModelObject.SetPropertiesValueCommand" style="margin: 5px" />
</td>
<td>
<input type="button" value="Agregar configuración" class="btn bg-warning" data-bind="click: DetailViewModelObject.AddConfigCommandChild" style="margin: 5px" />
</td>
</tr>
<tr>
<td colspan="5">
@Html.Partial("~/Views/ApplicationConfig/_PartialApplicationConfigDetail.cshtml")
</td>
</tr>
</table>
</li>
</ul>
But appears the follow error:
StackOverFlowException on mscorlib.dll
And the process ends ...
So: It's posible make this? Have any of you idea how to build that?
I'm using knockout and I making a tree of class and for render to user Im reusing PartialViews them self
Upvotes: 1
Views: 645
Reputation: 16973
This exception (behaviour) is absolutely normal because you are creating an endless recursion:
Your view renders the same view, which renders the same view, which renders the same view... and that stops when StackOverflowException
is hit.
Put some condition (if
in the view) (recursion bottom) to stop it.
Another solution I can suggest you is to use Knockout and call an action to display the view using AJAX.
Upvotes: 4