/// <summary>
        /// Creates the control main element.
        /// </summary>
        /// <returns>The IFWHtmlElement object representation of the control.</returns>
        protected override IFWHtmlElement CreateControl()
        {
            CreateLineActions();

            var detailControl = new FWPortletControl(Id, GetModelResource(OriginalId));

            detailControl.AddCssClass("fw-detail-table");
            detailControl.DataType("fw-detailcontrol");

            detailControl.Attributes.Add("data-model", ListType.Name);

            detailControl.AddAction(FWDetailHelper.CreateUndoButton());

            detailControl.Required(Metadata.IsRequired);

            detailControl.Footer(FWDetailHelper.CreateAddButton().ToString());

            detailControl.Attributes.AddRange(Attributes);
            if (!string.IsNullOrWhiteSpace(CustomCss))
            {
                detailControl.AddCssClass(CustomCss);
            }
            // Clears custom attributes and css to prevent adding to the base table control.
            Attributes.Clear();
            ClearCss();

            var grid = base.CreateControl() as FWTagBuilder;

            grid.DataType = "fw-detailcontrol-body";
            grid.Attributes.Add("role", "grid");

            detailControl.Add(grid);

            if (Metadata.IsRequired)
            {
                var validationDiv = new FWDivElement();
                {
                    validationDiv.DataType = "fw-detailvalidation";
                    validationDiv.AddCssClass("m-form__group form-group");

                    //Creates the validation input
                    var validationInput = new FWInputElement("DetailValidation", FWInputType.Hidden);
                    validationInput.Attributes.Add("data-rule-requireddetail", Metadata.IsRequired.ToString().ToLower());
                    validationInput.Attributes.Add("data-msg-requireddetail", string.Format(ViewResources.Validation_Required_Detail, GetModelResource(OriginalId)));
                    validationInput.Attributes.Add("data-skipvalidation", "false");

                    validationDiv.Add(validationInput);

                    detailControl.Add(validationDiv);
                }
            }

            detailControl.Add(RegisterTemplate());

            return(detailControl);
        }
        /// <summary>
        /// Creates the control main element.
        /// </summary>
        /// <returns>The IFWHtmlElement object representation of the control.</returns>
        protected override IFWHtmlElement CreateControl()
        {
            var detailControl = new FWPortletControl(Id, GetModelResource());

            detailControl.AddCssClass("fw-detail-grid");
            detailControl.DataType("fw-detailcontrol");

            detailControl.Attributes.Add("data-model", _listType.Name);

            detailControl.AddAction(FWDetailHelper.CreateUndoButton());

            detailControl.Required(IsRequired);

            detailControl.Footer(FWDetailHelper.CreateAddButton().ToString());

            detailControl.Attributes.AddRange(Attributes);
            if (!string.IsNullOrWhiteSpace(CustomCss))
            {
                detailControl.AddCssClass(CustomCss);
            }

            var body = new FWDivElement()
            {
                DataType = "fw-detailcontrol-body"
            };

            if (Model != null)
            {
                int i    = 0;
                var list = Model as IEnumerable;
                foreach (var item in list)
                {
                    body.Add(CreateBody(item, i.ToString()));
                    i++;
                }
            }

            detailControl.Add(body);

            if (IsRequired)
            {
                var validationDiv = new FWDivElement();
                {
                    validationDiv.DataType = "fw-detailvalidation";
                    validationDiv.AddCssClass("m-form__group form-group");

                    //Creates the fileupload validation input
                    var validationInput = new FWInputElement("DetailValidation", FWInputType.Hidden);
                    validationInput.Attributes.Add("data-rule-requireddetail", "true");
                    validationInput.Attributes.Add("data-msg-requireddetail", string.Format(ViewResources.Validation_Required_Detail, GetModelResource()));
                    validationInput.Attributes.Add("data-skipvalidation", "false");

                    validationDiv.Add(validationInput);

                    detailControl.Add(validationDiv);
                }
            }

            detailControl.Add(RegisterTemplate());

            return(detailControl);
        }