/// <summary> /// Creates the control. /// </summary> /// <param name="view">The view.</param> /// <param name="type">The type.</param> /// <param name="assembly">The assembly.</param> /// <param name="contextName">Name of the context.</param> /// <returns>Sitecore.Web.UI.WebControl.</returns> public static global::Sitecore.Web.UI.WebControl CreateControl(string view, string contextName) { var razorView = ViewManager.GetRazorView(view); if (razorView == null) { return(AbstractCachingRenderingType.ErrorControl(view)); } IRazorControl control = new PartialControl(); control.View = razorView; control.ContextName = contextName; return(control as global::Sitecore.Web.UI.WebControl); }
/// <summary> /// Creates the control. /// </summary> /// <param name="view">The view.</param> /// <param name="contextName">Name of the context.</param> /// <returns>Sitecore.Web.UI.WebControl.</returns> public static Sitecore.Web.UI.WebControl CreateControl(string view, string contextName) { var razorView = ViewManager.GetRazorView(view); if (razorView == null) { return(ErrorControl(view)); } IRazorControl control = new PartialControl(); control.View = razorView; control.ContextName = contextName; return(control as Sitecore.Web.UI.WebControl); }