public void RenderSearchBox(TextWriter writer)
        {
            HtmlComposite col1 = new HtmlComposite("div", new HtmlAttribute("class", "col-xs-3"));

            HtmlComposite rowb1 = col1.AppendComposite("div", new HtmlAttribute("class", "row-fluid"));

            HtmlComposite cellb1 = rowb1.AppendComposite("div", new HtmlAttribute("class", "col-xs-10"));

            cellb1.AppendStandalone("input",
                                    new HtmlAttribute("type", "text"),
                                    new HtmlAttribute("placeholder", "Search"),
                                    new HtmlAttribute("name", _SearchFilter.Key),
                                    new HtmlAttribute("id", _SearchFilter.Key),
                                    new HtmlAttribute("class", "form-control changeReload"),
                                    new HtmlAttribute("value", _SearchFilter.Value));

            HtmlComposite cellb2 = rowb1.AppendComposite("div", new HtmlAttribute("class", "col-xs-2"));

            cellb2.AppendComposite("button",
                                   new HtmlAttribute("type", "text"),
                                   new HtmlAttribute("class", "btn btn-primary pull-right"))
            .AppendSimple("i", "",
                          new HtmlAttribute("class", "fa fa-search"));

            col1.Write(writer);
        }
        public HtmlComposite Execute <T>(ClassSelect <T> select, NameValueCollection parameters)
        {
            ClassSelectResult <T> result = ExecuteSelect <T>(select);

            HtmlComposite form = new HtmlComposite(
                "form",
                new HtmlAttribute("method", "get"));

            form.AppendStandalone("input",
                                  new HtmlAttribute("type", "hidden"),
                                  new HtmlAttribute("name", "orderBy"),
                                  new HtmlAttribute("value", this.OrderBy));

            form.AppendStandalone("input",
                                  new HtmlAttribute("type", "hidden"),
                                  new HtmlAttribute("name", "orderByDirection"),
                                  new HtmlAttribute("value", this.OrderByDirection));

            form.AppendStandalone("input",
                                  new HtmlAttribute("type", "hidden"),
                                  new HtmlAttribute("name", "page"),
                                  new HtmlAttribute("value", "0"));

            if (parameters != null)
            {
                AppendUnrelatedFilters(form, select.Aspect, parameters);
            }

            HtmlComposite table = form.AppendComposite(
                "table",
                new HtmlAttribute("class", "table table-condensed table-striped table-bordered table-hover")
                );

            table.Children.AddLast(BuildTableHeader <T>());
            table.Children.AddLast(BuildTableBody <T>(result));
            table.Children.AddLast(BuildTableFooter <T>(result));

            return(form);
        }
 private void AppendUnrelatedFilters(HtmlComposite composite, Aspect aspect, NameValueCollection parameters)
 {
     foreach (string key in parameters.AllKeys)
     {
         if (
             !"orderBy".Equals(key, StringComparison.OrdinalIgnoreCase) &&
             !"orderByDirection".Equals(key, StringComparison.OrdinalIgnoreCase) &&
             !"page".Equals(key, StringComparison.OrdinalIgnoreCase) &&
             !"pageSize".Equals(StringComparison.OrdinalIgnoreCase) &&
             !aspect.HasMember(key))
         {
             composite.AppendStandalone("input",
                                        new HtmlAttribute("type", "hidden"),
                                        new HtmlAttribute("name", key),
                                        new HtmlAttribute("value", parameters[key]));
         }
     }
 }
        private HtmlComposite BuildTableHeader <T>()
        {
            HtmlComposite thead = new HtmlComposite("thead");

            HtmlComposite thead_tr = thead.AppendComposite("tr");

            foreach (BootstrapQueryHelperColumn col in this.columns)
            {
                HtmlComposite th  = thead_tr.AppendComposite("th");
                HtmlComposite tha = th.AppendComposite("a");

                tha.AppendText(col.Caption + "   ");
                tha.AppendAttribute("href", "javascript:void(0)");

                if (col.Name.Equals(this.OrderBy, StringComparison.OrdinalIgnoreCase))
                {
                    if (this.OrderByDirection == EixoX.Data.SortDirection.Ascending)
                    {
                        tha.AppendSimple(
                            "span",
                            "",
                            new HtmlAttribute("class", "fa fa-sort-asc"));


                        tha.AppendAttribute("onclick", string.Concat("EixoX.sortGrid(this,'", col.Name, "','", EixoX.Data.SortDirection.Descending, "')"));
                    }
                    else
                    {
                        tha.AppendSimple(
                            "span",
                            "",
                            new HtmlAttribute("class", "fa fa-sort-desc"));

                        tha.AppendAttribute("onclick", string.Concat("EixoX.sortGrid(this,'", col.Name, "','", EixoX.Data.SortDirection.Ascending, "')"));
                    }
                }
                else
                {
                    tha.AppendSimple(
                        "span",
                        "",
                        new HtmlAttribute("class", "fa fa-sort"));

                    tha.AppendAttribute("onclick", string.Concat("EixoX.sortGrid(this,'", col.Name, "','", EixoX.Data.SortDirection.Ascending, "')"));
                }
            }

            HtmlComposite tr2 = thead.AppendComposite("tr");

            foreach (BootstrapQueryHelperColumn col in this.columns)
            {
                HtmlComposite th2 = tr2.AppendComposite(
                    "td",
                    new HtmlAttribute("style", "padding:0px")
                    );

                th2.AppendStandalone(
                    "input",
                    new HtmlAttribute("type", "text"),
                    new HtmlAttribute("placeholder", "filtrar"),
                    new HtmlAttribute("name", col.Name),
                    new HtmlAttribute("value", col.Filter),
                    new HtmlAttribute("style", "margin:0px; border-radius:0px; display:block; width:94%; border:none;"));
            }

            return(thead);
        }
        public void RenderPagination(TextWriter writer)
        {
            HtmlComposite coldiv = new HtmlComposite("div", new HtmlAttribute("class", "col-xs-6"));

            coldiv.AppendStandalone(
                "input",
                new HtmlAttribute("type", "hidden"),
                new HtmlAttribute("name", _PageOrdinal.Key),
                new HtmlAttribute("id", _PageOrdinal.Key),
                new HtmlAttribute("value", Result.PageOrdinal));


            HtmlComposite paginationUl = coldiv.AppendComposite(
                "ul",
                new HtmlAttribute("class", "pagination pull-right"));

            paginationUl.AppendComposite(
                "li",
                new HtmlAttribute("class", ""))
            .AppendSimple(
                "a",
                "First",
                new HtmlAttribute("id", "firstPage"),
                new HtmlAttribute("href", "#"));

            //Previous page button
            paginationUl.AppendComposite(
                "li",
                new HtmlAttribute("class", Result.HasPreviousPages ? "" : "disabled"))
            .AppendSimple(
                "a",
                "Previous",
                new HtmlAttribute("id", "previousPage"),
                Result.HasPreviousPages ? new HtmlAttribute("href", "#") : new HtmlAttribute());

            //Records found
            paginationUl.AppendComposite(
                "li",
                new HtmlAttribute("class", ""))
            .AppendSimple(
                "a",
                Result.RecordCount + " records. Page " + (Result.PageOrdinal + 1) + " of " + Result.PageCount,
                new HtmlAttribute());

            //Next page button
            paginationUl.AppendComposite(
                "li",
                new HtmlAttribute("class", Result.HasMorePages ? "" : "disabled"))
            .AppendSimple(
                "a",
                "Next",
                new HtmlAttribute("id", "nextPage"),
                Result.HasMorePages ? new HtmlAttribute("href", "#") : new HtmlAttribute());

            //Last page button
            paginationUl.AppendComposite(
                "li",
                new HtmlAttribute("class", Result.HasMorePages ? "" : "disabled"))
            .AppendSimple(
                "a",
                "Last",
                new HtmlAttribute("id", "lastPage"),
                Result.HasMorePages ? new HtmlAttribute("href", "#") : new HtmlAttribute());

            coldiv.Write(writer);
        }