public MvcHtmlString ToHtmlUpdate_CustomerRegis(string id, string CssClass, string EditPath, string DeletePath, bool showHeader = true, bool showStt = true, string pamameters = "", string objId = "", bool detail = false, List <string> listbuycontinue = null)
        {
            var table = new TagBuilder("table");

            table.GenerateId(id);
            table.AddCssClass(CssClass);

            //For Declaration Of All Require Tag...!!!
            TagBuilder thead = new TagBuilder("thead");
            TagBuilder tr    = new TagBuilder("tr");

            //Hiển thị hay không hiển thị header table
            if (!showHeader)
            {
                tr.MergeAttribute("style", "display:none");
            }
            TagBuilder td = null;
            //TagBuilder th = new TagBuilder("th");
            TagBuilder th    = null;
            TagBuilder tbody = new TagBuilder("tbody");
            //tbody.MergeAttribute("role", "rowgroup");
            //Inner html Of Table...!!!
            StringBuilder sb = new StringBuilder();
            //Add Headers...!!!
            //int i = 0;
            var thStt = new TagBuilder("th");

            thStt.InnerHtml = "<span>Stt</span>";
            thStt.AddCssClass("center");
            var thFirst = new TagBuilder("th");

            thFirst.InnerHtml = "<label><input type = \"checkbox\" id = \"chkAll\" class=\"ace\"><span class=\"lbl\"></span></label><input id=\"hidListCheckbox\" name=\"hidListCheckbox\" type=\"hidden\" value=\"\">";
            //thFirst.MergeAttribute("width", "30");
            thFirst.AddCssClass("center");
            if (showStt)
            {
                tr.InnerHtml = thStt.ToString();
            }
            tr.InnerHtml += thFirst.ToString();
            int i        = 0;
            var colgroup = new StringBuilder();

            colgroup.AppendLine("<colgroup>");
            if (showStt)
            {
                colgroup.AppendLine("<col style=\"width: 3% \">");
            }
            colgroup.AppendLine("<col style=\"width: 3% \">");
            int count = 0;

            foreach (ITableColumnInternal <TModel> tc in this.TableColumns)
            {
                th = new TagBuilder("th");
                count++;
                //C#1-------------------
                //th.InnerHtml = tc.ColumnTitle + " <i class='fa fa-ellipsis-v'></i>";
                //if (!string.IsNullOrWhiteSpace(tc.ColumnClass))
                //    th.AddCssClass(tc.ColumnClass);
                //if (!string.IsNullOrWhiteSpace(tc.ColumnWidth))
                //    th.MergeAttribute("width", tc.ColumnWidth);
                //th.MergeAttribute("data-field", tc.ColumnName);
                //th.MergeAttribute("data-sort", "asc"); //mặc định sắp xếp tăng dần

                //C#2------------------------
                //if (i == 0)
                //{
                //    th.InnerHtml = tc.ColumnTitle;
                //    //th.MergeAttribute("style", "display:none;");
                //}
                //else
                //{
                //    colgroup.AppendLine(string.Format("<col style=\"width: {0}% \">", !string.IsNullOrWhiteSpace(tc.ColumnWidth) ? tc.ColumnWidth : ""));
                //    th.InnerHtml = string.Format("<a href='javascript:void(0);'><label>{0}</label>  <i class='fa fa-ellipsis-v'></i></a>", tc.ColumnTitle);
                //    if (!string.IsNullOrWhiteSpace(tc.ColumnClass))
                //        th.AddCssClass(tc.ColumnClass);
                //    //if (!string.IsNullOrWhiteSpace(tc.ColumnWidth))
                //    //    th.MergeAttribute("width", tc.ColumnWidth);
                //    th.MergeAttribute("data-field", tc.ColumnName);
                //    th.MergeAttribute("data-sort", "asc"); //mặc định sắp xếp tăng dần
                //}
                if (count == 1)
                {
                    colgroup.AppendLine(string.Format("<col style=\"width: {0}%;display:none; \">", !string.IsNullOrWhiteSpace(tc.ColumnWidth) ? tc.ColumnWidth : ""));
                }
                else
                {
                    colgroup.AppendLine(string.Format("<col style=\"width: {0}% \">", !string.IsNullOrWhiteSpace(tc.ColumnWidth) ? tc.ColumnWidth : ""));
                }


                th.InnerHtml = string.Format("<a href='javascript:void(0);'><label>{0}</label>  <i class='fa fa-ellipsis-v'></i></a>", tc.ColumnTitle);
                if (!string.IsNullOrWhiteSpace(tc.ColumnClass))
                {
                    th.AddCssClass(tc.ColumnClass);
                }
                //if (!string.IsNullOrWhiteSpace(tc.ColumnWidth))
                //    th.MergeAttribute("width", tc.ColumnWidth);
                th.MergeAttribute("data-field", tc.ColumnName);
                th.MergeAttribute("data-sort", "asc"); //mặc định sắp xếp tăng dần

                //i++;
                if (showHeader)
                {
                    tr.InnerHtml += th.ToString();
                }
            }
            colgroup.AppendLine("<col style=\"width: 8% \">");
            colgroup.AppendLine("</colgroup>");
            th.InnerHtml    = "<label>Thao tác</label>";
            tr.InnerHtml   += th.ToString();
            thead.InnerHtml = tr.ToString();
            sb.Append(colgroup.ToString());
            sb.Append(thead.ToString());

            //For Row Data and Coloumn...!!!
            if (this.Data != null)
            {
                //var data in RowDetail
                int row = 0;
                foreach (TModel model in this.Data)
                {
                    if (model != null)
                    {
                        var tdStt = new TagBuilder("td");
                        tdStt.InnerHtml = (row + 1).ToString();
                        tdStt.AddCssClass("center");

                        var tdFirst = new TagBuilder("td");
                        ITableColumnInternal <TModel> tcFirst = this.TableColumns.FirstOrDefault(c => c.ColumnName.ToLower() == "id");

                        tdFirst.InnerHtml = string.Format("<label><input type=\"checkbox\" class=\"ace chkItem\" value=\"{0}\" /><span class=\"lbl\"></span></label>", tcFirst != null ? tcFirst.Evaluate(model) : "");
                        tdFirst.Attributes.Add("name", "chkrow");
                        tdFirst.AddCssClass("center");
                        tr = new TagBuilder("tr");
                        if (showStt)
                        {
                            tr.InnerHtml += tdStt.ToString();
                        }
                        tr.InnerHtml += tdFirst.ToString();
                        var aa = tcFirst != null?tcFirst.Evaluate(model) : "";

                        tr.MergeAttribute("idata", aa);
                        tr.MergeAttribute("scope", "row");
                        tr.AddCssClass("trItem"); //dùng để chọn click view detailbox

                        if (!string.IsNullOrEmpty(objId))
                        {
                            if (objId.Equals(aa))
                            {
                                tr.AddCssClass("info");
                            }
                        }

                        //var header in Headernames
                        int    j  = 0;
                        string ID = "";
                        foreach (ITableColumnInternal <TModel> tc in this.TableColumns)
                        {
                            td = new TagBuilder("td");

                            //td.InnerHtml = tc.Evaluate(model);
                            //td.AddCssClass(tc.ColumnClass);

                            if (j == 0)
                            {
                                ID           = tc.Evaluate(model);
                                td.InnerHtml = tc.Evaluate(model);
                                td.Attributes.Add("name", "txtId");
                                td.MergeAttribute("style", "display:none;");
                            }
                            else
                            {
                                if (tc.ColumnName.Equals("Active"))
                                {
                                    if (tc.Evaluate(model).Equals("True"))
                                    {
                                        td.InnerHtml = "<span class=\"label label-sm label-success\">Hoạt động</span>";
                                    }
                                    else
                                    {
                                        td.InnerHtml = "<span class=\"label label-sm label-warning\">Ngừng hoạt động</span>";
                                    }
                                }
                                else if (tc.ColumnName.Equals("DateCreated"))
                                {
                                    td.InnerHtml = Convert.ToDateTime(tc.Evaluate(model)).ToString("dd/MM/yyyy HH:mm");
                                }
                                else
                                {
                                    td.InnerHtml = tc.Evaluate(model);
                                }
                                td.AddCssClass(tc.ColumnClass);
                            }
                            tr.InnerHtml += td.ToString();

                            j++;
                        }
                        if (detail)
                        {
                            if (listbuycontinue != null && listbuycontinue.Count > 0)
                            {
                                if (listbuycontinue.Contains(aa))
                                {
                                    td.InnerHtml = "<a href='javascript:void(0);' idata='" + ID + "' name='btnDetail' class='green btnDetail'><i class=\"ace-icon fa fa-eye bigger-150\"></i></a> <a href='javascript:void(0);' idata='" + ID + "' name='btnDelete' class='red btnDelete'><i class=\"ace-icon fa fa-trash bigger-150\"></i></a>";
                                }
                                else
                                {
                                    td.InnerHtml = "<a href='" + EditPath + ID + pamameters + "' idata='" + ID + "' name='btnUpdate'><i class=\"ace-icon fa fa-pencil bigger-150\"></i></a> <a href='javascript:void(0);' idata='" + ID + "' name='btnDetail' class='green btnDetail'><i class=\"ace-icon fa fa-eye bigger-150\"></i></a> <a href='javascript:void(0);' idata='" + ID + "' name='btnDelete' class='red btnDelete'><i class=\"ace-icon fa fa-trash bigger-150\"></i></a>";
                                }
                            }
                            else
                            {
                                td.InnerHtml = "<a href='" + EditPath + ID + pamameters + "' idata='" + ID + "' name='btnUpdate'><i class=\"ace-icon fa fa-pencil bigger-150\"></i></a> <a href='javascript:void(0);' idata='" + ID + "' name='btnDetail' class='green btnDetail'><i class=\"ace-icon fa fa-eye bigger-150\"></i></a> <a href='javascript:void(0);' idata='" + ID + "' name='btnDelete' class='red btnDelete'><i class=\"ace-icon fa fa-trash bigger-150\"></i></a>";
                            }
                        }
                        else
                        {
                            td.InnerHtml = "<a href='" + EditPath + ID + pamameters + "' idata='" + ID + "' name='btnUpdate'><i class=\"ace-icon fa fa-pencil bigger-120\"></i></a> <a href='javascript:void(0);' idata='" + ID + "' name='btnDelete' class='red btnDelete'><i class=\"ace-icon fa fa-trash bigger-120\"></i></a>";
                        }

                        td.Attributes.Add("name", "txtUpdate");
                        tr.InnerHtml    += td.ToString();
                        tbody.InnerHtml += tr.ToString();
                        row++;
                    }
                }

                sb.Append(tbody.ToString());
                table.InnerHtml = sb.ToString();
            }
            return(new MvcHtmlString(table.ToString()));
        }
        /// <summary>
        /// Convert the TableBuilder to HTML.
        /// </summary>
        public MvcHtmlString ToHtml(string id, string CssClass, string EditPath, string DeletePath, bool showHeader = true)
        {
            var table = new TagBuilder("table");

            table.GenerateId(id);
            table.AddCssClass(CssClass);
            table.MergeAttribute("role", "grid");



            //For Declaration Of All Require Tag...!!!
            TagBuilder thead = new TagBuilder("thead");
            TagBuilder tr    = new TagBuilder("tr");

            //Hiển thị hay không hiển thị header table
            if (!showHeader)
            {
                tr.MergeAttribute("style", "display:none");
            }
            TagBuilder td = null;
            //TagBuilder th = new TagBuilder("th");
            TagBuilder th    = null;
            TagBuilder tbody = new TagBuilder("tbody");

            tbody.MergeAttribute("role", "rowgroup");
            //Inner html Of Table...!!!
            StringBuilder sb = new StringBuilder();
            //Add Headers...!!!
            //int i = 0;


            var thFirst = new TagBuilder("th");

            thFirst.InnerHtml = "<label><input type = \"checkbox\" id = \"chkAll\" class=\"ace\"><span class=\"lbl\"></span></label><input id=\"hidListCheckbox\" name=\"hidListCheckbox\" type=\"hidden\" value=\"\">";
            //thFirst.MergeAttribute("width", "30");
            thFirst.AddCssClass("center");
            tr.InnerHtml = thFirst.ToString();
            int i        = 0;
            var colgroup = new StringBuilder();

            colgroup.AppendLine("<colgroup>");
            colgroup.AppendLine("<col style=\"width: 3% \">");
            foreach (ITableColumnInternal <TModel> tc in this.TableColumns)
            {
                th = new TagBuilder("th");

                //th.InnerHtml = tc.ColumnTitle + " <i class='fa fa-ellipsis-v'></i>";
                //if (!string.IsNullOrWhiteSpace(tc.ColumnClass))
                //    th.AddCssClass(tc.ColumnClass);
                //if (!string.IsNullOrWhiteSpace(tc.ColumnWidth))
                //    th.MergeAttribute("width", tc.ColumnWidth);
                //th.MergeAttribute("data-field", tc.ColumnName);
                //th.MergeAttribute("data-sort", "asc"); //mặc định sắp xếp tăng dần
                if (i == 0)
                {
                    th.InnerHtml = tc.ColumnTitle;
                    th.MergeAttribute("style", "display:none;");
                }
                else
                {
                    colgroup.AppendLine(string.Format("<col style=\"width: {0}% \">", !string.IsNullOrWhiteSpace(tc.ColumnWidth) ? tc.ColumnWidth : ""));
                    th.InnerHtml = string.Format("<a href='javascript:void(0);'>{0}  <i class='fa fa-ellipsis-v'></i></a>", tc.ColumnTitle);
                    if (!string.IsNullOrWhiteSpace(tc.ColumnClass))
                    {
                        th.AddCssClass(tc.ColumnClass);
                    }
                    //if (!string.IsNullOrWhiteSpace(tc.ColumnWidth))
                    //    th.MergeAttribute("width", tc.ColumnWidth);
                    th.MergeAttribute("data-field", tc.ColumnName);
                    th.MergeAttribute("data-sort", "asc"); //mặc định sắp xếp tăng dần
                }
                i++;
                tr.InnerHtml += th.ToString();
            }
            colgroup.AppendLine("</colgroup>");
            //th.InnerHtml = "Action";
            //tr.InnerHtml += th.ToString();
            thead.InnerHtml = tr.ToString();
            sb.Append(colgroup.ToString());
            sb.Append(thead.ToString());

            //For Row Data and Coloumn...!!!
            if (this.Data != null)
            {
                //var data in RowDetail
                int row = 0;
                foreach (TModel model in this.Data)
                {
                    if (model != null)
                    {
                        var tdFirst = new TagBuilder("td");
                        ITableColumnInternal <TModel> tcFirst = this.TableColumns.FirstOrDefault(c => c.ColumnName.ToLower() == "id");

                        tdFirst.InnerHtml = string.Format("<label><input type=\"checkbox\" class=\"ace chkItem\" value=\"{0}\" /><span class=\"lbl\"></span></label>", tcFirst != null ? tcFirst.Evaluate(model) : "");
                        tdFirst.AddCssClass("center");
                        tr           = new TagBuilder("tr");
                        tr.InnerHtml = tdFirst.ToString();
                        var aa = tcFirst != null?tcFirst.Evaluate(model) : "";

                        tr.MergeAttribute("idata", aa);
                        tr.AddCssClass("trItem"); //dùng để chọn click view detailbox
                        //var header in Headernames
                        int j = 0;

                        foreach (ITableColumnInternal <TModel> tc in this.TableColumns)
                        {
                            td = new TagBuilder("td");

                            //td.InnerHtml = tc.Evaluate(model);
                            //td.AddCssClass(tc.ColumnClass);

                            if (j == 0)
                            {
                                //ID = tc.Evaluate(model);
                                td.InnerHtml = tc.Evaluate(model);
                                td.MergeAttribute("style", "display:none;");
                            }
                            else
                            {
                                td.InnerHtml = tc.Evaluate(model);
                                td.AddCssClass(tc.ColumnClass);
                            }
                            tr.InnerHtml += td.ToString();

                            j++;
                        }
                        //td.InnerHtml = "<a href='" + EditPath + ID + "'>edit</a> <a href='" + DeletePath + ID + "'>delete</a>";
                        //tr.InnerHtml += td.ToString();
                        tbody.InnerHtml += tr.ToString();
                        row++;
                    }
                }

                sb.Append(tbody.ToString());
                table.InnerHtml = sb.ToString();
            }
            return(new MvcHtmlString(table.ToString()));
        }