Example #1
0
 protected UIBuilder(IUIContainerBuilder containerBuilder)
 {
     if (containerBuilder == null)
     {
         throw new ArgumentNullException("containerBuilder");
     }
     ContainerBuilder = containerBuilder;
 }
 public HtmlHelperUIBuilder(HtmlHelper <TModel> htmlHelper, IUIContainerBuilder containerBuilder)
     : base(containerBuilder)
 {
     if (htmlHelper == null)
     {
         throw new ArgumentNullException("htmlHelper");
     }
     HtmlHelper = htmlHelper;
 }
Example #3
0
 //can the containerBuilder parameter be removed? -vk 5/14/13
 public KnockoutUIBuilder(HtmlHelper <TModel> htmlHelper, IUIContainerBuilder containerBuilder)
     : base(htmlHelper, containerBuilder)
 {
     _controllerContext = htmlHelper.ViewContext.Controller.ControllerContext;
 }
 public TestableKnockoutUIBuilder(HtmlHelper <TModel> htmlHelper, IUIContainerBuilder containerBuilder)
     : base(htmlHelper, containerBuilder)
 {
 }
Example #5
0
        private string BuildDisplayUIFromLambdaExpression(LambdaExpression expression, object additionalViewData, IUIContainerBuilder containerBuilder = null)
        {
            if (expression.ReturnType.IsComplexType())
            {
                return(RenderDisplayForType(expression, additionalViewData).ToHtmlString());
            }

            var methodInfo          = GetType().GetMethods().First(m => m.Name == "DisplayFieldsetFor" && m.GetParameters().Count() == 2);
            var genericMethod       = methodInfo.MakeGenericMethod(expression.ReturnType);
            var displayFieldsetHtml = ((MvcHtmlString)genericMethod.Invoke(this, new[] { expression, additionalViewData })).ToHtmlString();

            if (containerBuilder != null)
            {
                var container = containerBuilder.BuildUIContainer(null, additionalViewData);
                container.InnerHtml = displayFieldsetHtml;
                return(container.ToString());
            }

            return(displayFieldsetHtml);
        }