ThrowNewInvalidOperationException(String.Format(CultureInfo.CurrentCulture,"The partial view '{0}' was not found or no view engine supports the searched locations. The following locations were searched:{1}",NewObject(){partialViewName,builder}))
EndFunction
' copied from HtmlHelper.RenderPartialInternal (thanks Red Gate!)
''' Renders the specified partial view as an HTML-encoded string (even if the model is null).
''' This is a safer method than the normal HtmlHelper.Partial() because that one will use the current Model as a fallback when the given model is null.
''' </summary>
''' <param name="htmlHelper">The HTML helper instance that this method extends.</param>
''' <param name="partialViewName">The name of the partial view to render.</param>
''' <param name="model">The model for the partial view, may be null</param>
''' <param name="viewData">A new dictionary or null (in which case the current view data is used as a fallback)</param>
''' Renders the specified partial view as an HTML-encoded string unless the model is null.
''' The given wrapper is used to wrap around the output of the partial result, it uses the Razor @item to place the partial output within the wrapper's template.
''' Note the partial and the wrapper are not exectued when the model is null.
''' </summary>
''' <remarks>
''' Note that the partial is rendered before wrapper is executed (should there be side-effects in either of them).
''' </remarks>
''' <param name="htmlHelper">The HTML helper instance that this method extends.</param>
''' <param name="partialViewName">The name of the partial view to render.</param>
''' <param name="model">The model for the partial view, may be null</param>
''' <param name="wrapper">This wrapper is excuted when the model is not null, use @item to render the output of the partial</param>
''' <param name="viewData">A new dictionary or null (in which case the current view data is used as a fallback)</param>
''' <returns>The partial view that is rendered as an HTML-encoded string or null if the model is null.</returns>
''' Renders the specified partial view as an HTML-encoded string unless the model is null or empty.<br/>
''' The given wrapper is used to wrap around the output of the partial result, it uses the Razor @item to place the partial output within the wrapper's template.
''' Note the partial and the wrapper are not exectued when the model is null or empty.
''' </summary>
''' <remarks>
''' The enumerable passed into the model is checked with Any() to see whether it is empty.
''' In case of a LINQ query this may cause the enumerable to be called twice (once for the Any() check and once propably inside the partial).
''' Note that the partial is rendered before wrapper is executed (should there be side-effects in either of them).
''' </remarks>
''' <param name="htmlHelper">The HTML helper instance that this method extends.</param>
''' <param name="partialViewName">The name of the partial view to render.</param>
''' <param name="model">The model for the partial view, may be null or an empty enumerable</param>
''' <param name="wrapper">This wrapper is excuted when the model is not null or empty, use @item to render the output of the partial</param>
''' <param name="viewData">A new dictionary or null (in which case the current view data is used as a fallback)</param>
''' <returns>The partial view that is rendered as an HTML-encoded string or null if the model is null or empty.</returns>