Action Filters and ViewResults 

Action filters are defined in the MVCControlsToolkit.ActionFilters namespace, while ViewResults are defined in the MVCControlsToolkit.Controller namespace.

PlaceJavascriptAttribute. When applied to a view that renders text/html it moves all javascript contained in the html code just before the body end tag enclosing it within a (function($){....})(jQuery) wrapper. If the property NoWrapper is set to true the wrapper is not applied. If the property ApplyToPartial is set to true the same transformation is applied also to PartialViews(all javascript is placed at the end of the PartialView). All other properties are for future extensions. Important: the PlaceJavascriptAttribute filter is applied as a global filter by the standard Mvc Controls Toolkit Nuget installation.

AcceptViewHintAttribute  . If an Action method is decorated with the AcceptViewHint Action Filter, and it is passed a parameter named ViewHint either as route parameter or has post parameter, it uses the string passed as PartialView name. This way a master view can decide what PartialView be used by a child Action enhancing the re-usability of child actions. To prevent attacks of malicious users this name is truncated at 100 characters and it can only contains letters and numbers. If the value of ViewHint is the string json, the action method will return the ViewModel in jSon format. It accepts an optional argument of type JsonRequestBehavior

ClentValidationViewResult. Define a ViewContext for all input items rendered in it. It allows a partial View that doesn' contain a form be able to generate client side validation code. It is usefull to inject Ajax generated html into a pre-existing form. 

ClientBlockResult. Used to define a Client Block based on the whole server side ViewModel. It is returned by the ClientBlockView controller extension method. See here for more information on Client Blocks.

Last edited Jun 22, 2014 at 1:26 PM by frankabbruzzese, version 10

Comments

No comments yet.