Beispiel #1
0
        /// <summary>
        /// Renders the partial view.
        /// </summary>
        /// <returns>The partial view.</returns>
        /// <param name="viewPath">View path.</param>
        /// <param name="model">Model.</param>
        /// <param name="controllerContext">Controller context.</param>
        public static string RenderPartialView(string viewPath, object model,
                                               ControllerContext controllerContext)
        {
            RenderRazor renderer = new RenderRazor(controllerContext);

            return(renderer.RenderPartialView(viewPath, model));
        }
Beispiel #2
0
 /// <summary>
 /// Renders the partial view.
 /// </summary>
 /// <returns>The partial view.</returns>
 /// <param name="viewPath">View path.</param>
 /// <param name="model">Model.</param>
 /// <param name="controllerContext">Controller context.</param>
 /// <param name="errorMessage">Error message.</param>
 public static string RenderPartialView(string viewPath, object model,
                                        ControllerContext controllerContext,
                                        out string errorMessage)
 {
     errorMessage = null;
     try
     {
         RenderRazor renderer = new RenderRazor(controllerContext);
         return(renderer.RenderPartialView(viewPath, model));
     }
     catch (Exception ex)
     {
         errorMessage = ex.GetBaseException().Message;
     }
     return(null);
 }