PlaceJavascriptAttribute causes error

Nov 26, 2014 at 4:01 PM
Edited Nov 26, 2014 at 4: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:

Page1.cshtml:
<body>
@Html.RenderAction("Page2","Controller")
</body>
Page2.cshtml:
<body>
Whatever
</body>
Here is the exception:
System.Web.HttpException occurred
  HResult=-2147467259
  Message=Filtering is not allowed.
  Source=System.Web
  ErrorCode=-2147467259
  WebEventCode=0
  StackTrace:
       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
  InnerException: 
Coordinator
Nov 26, 2014 at 6: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 7:15 PM
Actually, it's returning a ClientBlockView.
Coordinator
Nov 27, 2014 at 7:47 AM
So, it should return a ClientBlockPartialResult instead, since Action just fill a part of an html page, instead of a full page.