This project is read-only.

PlaceJavascriptAttribute causes error

Nov 26, 2014 at 5:01 PM
Edited Nov 26, 2014 at 5:02 PM
I've recently upgraded to the newest version, and have tried adding the PlaceJavascriptAttribute to my MVC filters, but I get a "Filtering is not allowed." exception in the PlaceJavascriptAttribute.cs file.

This exception occurs inside a call to Html.RenderAction. I'm not sure if this feature is just not supported inside an Html.RenderAction, or if the code needs to be modified to support it.

When the exception occurs, filterContext.HttpContext.Response.Filter == null on line #294 of PlaceJavascriptAttribute.cs.

So for example:

Here is the exception:
System.Web.HttpException occurred
  Message=Filtering is not allowed.
       at System.Web.HttpResponse.set_Filter(Stream value)
       at System.Web.HttpResponseWrapper.set_Filter(Stream value)
       at MVCControlsToolkit.ActionFilters.PlaceJavascriptAttribute.OnResultExecuting(ResultExecutingContext filterContext) in v:\Hef\Repositories\Projects\HealtheFormatics\EMRchive\External\CodePlex\MVCControlsToolkit\MVCControlToolkit\ActionFilters\PlaceJavascriptAttribute.cs:line 294
Nov 26, 2014 at 7:37 PM
This maybe due to your RenderAction action method returning a View instead of a PartialView. Verify this and let me know.
Nov 26, 2014 at 8:15 PM
Actually, it's returning a ClientBlockView.
Nov 27, 2014 at 8:47 AM
So, it should return a ClientBlockPartialResult instead, since Action just fill a part of an html page, instead of a full page.