Attempting to update multiple partial views from a single Ajax.ActionLink
Posted
by mwright
on Stack Overflow
See other posts from Stack Overflow
or by mwright
Published on 2010-04-07T22:01:25Z
Indexed on
2010/04/07
22:03 UTC
Read the original article
Hit count: 1257
I have a a partial view which contains other partial views. I am trying to the main partial view ( "MainPartialView" ) from an Ajax.ActionLink in a partial view contained by the main partial view ( "DetailsView" ). Everything appears to be called just fine and I can step through and it executes all of the code on the pages. However, after that is all done it throws this error in a popup box in visual studio:
htmlfile: Unknown runtime error
This error puts the break point in the MicrosoftAjax.js file, Line 5, Col 83,632, Ch 83632.
Any thoughts?
Index Page:
<script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>
<ul>
<% foreach (DomainObject domainObject in Model) { %>
<% Html.RenderPartial("MainPartialView", domainObject); %>
<% } %>
</ul>
MainPartialView:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<DomainObject>" %>
<li>
<div id="<%= Model.Id%>">
<%= Ajax.ActionLink("Details",
"PartialViewAction",
"PartialViewController",
new { id = Model.Id, },
new AjaxOptions { UpdateTargetId ="UpdateTargetId" })%>
<% Html.RenderPartial("Details", Model); %>
<div id="Details"></div>
</div>
</li>
Details:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<DomainObject>" %>
<% foreach ( var link in Model.Links)
{%>
<div>
<div>
<%= link.Name %>
</div>
<div>
<%= Ajax.ActionLink("Submit this Action",
"DoAction",
"XTrademark",
new { id = Model.TrademarkId, id2 = actionStateLink.ActionStateLinkId },
new AjaxOptions{ UpdateTargetId = Model.TrademarkId.ToString()} )%>
</div>
</div>
<br />
<%} %>
© Stack Overflow or respective owner