Esempio n. 1
0
        /// <summary>
        /// 渲染部分视图
        /// </summary>
        /// <param name="context">当前 HTTP 请求上下文</param>
        /// <param name="virtualPath">部分视图的虚拟路径</param>
        /// <returns>渲染结果</returns>
        public static string RenderPartial(HttpContextBase context, string virtualPath)
        {
            var handler = HtmlHandlerProvider.GetHandler(virtualPath);

            if (handler == null)
            {
                return(HtmlServices.LoadContent(virtualPath).Content);
            }

            var partialHandler = new JumonyPartialHandler();

            return(partialHandler.RenderPartial(context, virtualPath, handler));
        }
Esempio n. 2
0
    /// <summary>
    /// 渲染部分视图
    /// </summary>
    /// <param name="context">当前 HTTP 请求上下文</param>
    /// <param name="virtualPath">部分视图的虚拟路径</param>
    /// <returns>渲染结果</returns>
    public static string RenderPartial( HttpContextBase context, string virtualPath )
    {

      var handler = HtmlHandlerProvider.GetHandler( virtualPath );

      if ( handler == null )
        return HtmlServices.LoadContent( virtualPath ).Content;

      var partialHandler = new JumonyPartialHandler();
      return partialHandler.RenderPartial( context, virtualPath, handler );


    }
Esempio n. 3
0
        /// <summary>
        /// 渲染指定了路径的部分视图
        /// </summary>
        /// <param name="path">部分视图的路径</param>
        /// <returns>渲染结果</returns>
        protected virtual string RenderVirtualPath(string path)
        {
            if (!VirtualPathUtility.IsAppRelative(path))
            {
                throw VirtualPathHelper.VirtualPathFormatError("path");
            }


            var result = JumonyPartialHandler.RenderPartial(HttpContext, path);

            if (result == null)
            {
                throw new HttpException(404, "找不到部分视图");
            }

            else
            {
                return(result);
            }
        }