Exemple #1
0
        public IHtmlString WithFilterButton(bool inSeparateRow = false, string filterFunction = "RefreshGrid", bool useUnobtrusive = false, string filterButtonLabel = null)
        {
            var filterButton = useUnobtrusive
                                   ? htmlHelper.UnobtrusiveFilterButton(filterButtonLabel).ToHtmlString()
                                   : htmlHelper.FilterButton(string.Format("{0}()", filterFunction), filterButtonLabel).ToHtmlString();
            var filterButtonBuilder = new FluentTagBuilder("td").AddToInnerHtml(filterButton);

            if (inSeparateRow)
            {
                if (lastRowBuilder != null)
                {
                    fluentTagBuilder.AddToInnerHtml(lastRowBuilder.AddToInnerHtml(emptyCellBuilder.ToString()));
                }
                var filterRow = new FluentTagBuilder("tr");
                filterRow
                .AddToInnerHtml(emptyCellBuilder.ToString())
                .AddToInnerHtml(filterButtonBuilder.AddAttribute("style", "text-align:right").ToString())
                .AddToInnerHtml(emptyCellBuilder.ToString());
                fluentTagBuilder.AddToInnerHtml(filterRow);
                return(this);
            }

            if (lastRowBuilder != null)
            {
                lastRowBuilder.AddToInnerHtml(filterButtonBuilder.ToString());
                fluentTagBuilder.AddToInnerHtml(lastRowBuilder);
                return(this);
            }

            return(this);
        }
Exemple #2
0
        public string ToHtmlString()
        {
            if (!createErrorDialogs)
            {
                return(fluentTagBuilder.ToString());
            }

            var addToInnerHtml = new FluentTagBuilder("script").AddAttribute("type", "text/javascript").AddToInnerHtml("common.createErrorDialogs()");

            return(fluentTagBuilder + addToInnerHtml.ToString());
        }
Exemple #3
0
        public EditorTableBuilder <TModel> WithDisplayFor <TValue>(Expression <Func <TModel, TValue> > expression, bool requiredField = true, string editorPostfix = null, bool visible = true)
        {
            if (!visible)
            {
                return(this);
            }

            FluentTagBuilder span = new FluentTagBuilder("span")
                                    .AddAttribute("id", htmlHelper.ClientIdFor(expression).ToHtmlString())
                                    .AddToInnerHtml(htmlHelper.DisplayFor(expression).ToHtmlString());

            BuildEditor(expression, requiredField, span.ToString(), null, editorPostfix);
            return(this);
        }
Exemple #4
0
        public GridFilterBuilder <TModel> WithEnumFilter <TValue, TEnum>(Expression <Func <TModel, TValue> > expression, int width = 200, string filterFunction = "RefreshGrid")
            where TEnum : struct
        {
            var enumEditor = htmlHelper.EnumDropDownList <TEnum>(ExpressionHelper.GetExpressionText(expression),
                                                                 emptyText: TextLocalization.All,
                                                                 customize: b => b.HtmlAttributes(GetDropDownHtmlAttributes(width)).Events(events => events.Change(filterFunction)));
            var buildRowWithLabel = BuildRowWithLabel(expression, enumEditor.ToHtmlString(), true, true);

            buildRowWithLabel.AddToInnerHtml(emptyCellBuilder.ToString());
            fluentTagBuilder.AddToInnerHtml(buildRowWithLabel);
            return(this);
        }
Exemple #5
0
 public string ToHtmlString()
 {
     return(fluentTagBuilder.ToString());
 }
        public FluentTagBuilder AddToInnerHtml(FluentTagBuilder tagBuilder)
        {
            mBuilder.InnerHtml += tagBuilder.ToString(TagRenderMode.Normal);

            return(this);
        }