ASP.NET MVC - PartialView not refreshing
- by Billy Logan
Hello Everyone,
I have a view that uses a javascript callback to reload a partial view. For whatever reason the contents of the partial class do not refresh even though i can step through the entire process and see the page being recalled and populated. Any reason why the page would not display?
Code is as follows:
<div id="big_image_content">
<% Html.RenderPartial("ZoomImage", Model); %>
</div>
This link should reload the div above:
<a href="javascript:void(0)" onclick="$('#big_image_content').load('/ShopDetai/ZoomImage);"
title="<%= shape.Shape %>" alt="<%= shape.Shape %>">
<img src="http://images.rugs-direct.com/<%= shape.Image.ToLower() %>" width="40" alt="<%= shape.Shape %>">
</a>
partial view(ZoomImage.ascx) simplified for now, but still doesn't load:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<RugsDirect.Data.ItemDetailsModel>" %>
<%= Model.Category.ToLower()%>
And finally the controller side of things:
public ActionResult ZoomImage()
{
try {
ItemDetailsModel model = GetMainImageContentModel();
return PartialView("ZoomImage", model);
}
catch (Exception ex)
{
//send the error email
ExceptionPolicy.HandleException(ex, "Exception Policy");
//redirect to the error page
return RedirectToAction("ViewError", "Shop");
}
}
Again, i can step through this entire process and all seems to be working accept for the page not reloading. I can even break on the <%= Model.Category.ToLower()% of the partial view, but it will not be displayed.
Thanks in advance,
Billy