/// <summary>
        /// Gets or sets the content type that will be used to load the control list items.
        /// This property is for security purpose only to move content types blocking logic from the pages.
        /// </summary>
        //public Nullable<ContentTypes> ContentType
        //{
        //    get { return ViewState.Get<Nullable<ContentTypes>>("ContentType"); }
        //    set { ViewState.Set<Nullable<ContentTypes>>("ContentType", value); }
        //}

        #endregion

        #region Methods

        protected override void OnPreRender(EventArgs e)
        {
            if (this.EnableCheckAll)
            {
                this.chkCheckAll = new CCheckBox();
                this.CssClass    = "checkall";
                this.chkCheckAll.Attributes.Add("data-action", "check-all");
                this.chkCheckAll.Attributes.Add("data-list-id", this.ClientID);
            }

            if (!string.IsNullOrEmpty(this.LabelResourceKey) || !string.IsNullOrEmpty(this.LabelText))
            {
                this.lbl = Utilities.CreateLabel(this.LabelResourceKey, this.LabelText);
                this.Controls.Add(lbl);
            }

            if (this.IsRequired)
            {
                this.cstmValidator = Utilities.CreateCustomValidator(this.ID, this.ValidationGroup, "ValidateCheckBoxList", "RequiredErrorMessage");
                this.cstmValidator.Attributes.Add("data-list-id", this.ClientID);
                this.Controls.Add(cstmValidator);
            }

            if (!this.PropertiesLoaded)
            {
                RepeatDirection       = System.Web.UI.WebControls.RepeatDirection.Vertical;
                this.Width            = Unit.Parse("100%");
                this.PropertiesLoaded = true;
            }
            // Apply security filtration on the drop down list based on the list content type.
            //if (this.ContentType.HasValue && SessionHelper.UserPermissionList != null)
            //{
            //    switch (this.ContentType.Value)
            //    {
            //        case ContentTypes.Country: this.Items.Cast<ListItem>().Where(item => !string.IsNullOrEmpty(item.Value) && !SessionHelper.UserPermissionList.Any(permission => permission.CountryID == int.Parse(item.Value))).ToList().ForEach(this.Items.Remove); break;
            //        case ContentTypes.Company: this.Items.Cast<ListItem>().Where(item => !string.IsNullOrEmpty(item.Value) && !SessionHelper.UserPermissionList.Any(permission => permission.CompanyID == int.Parse(item.Value))).ToList().ForEach(this.Items.Remove); break;
            //        case ContentTypes.Report: this.Items.Cast<ListItem>().Where(item => !string.IsNullOrEmpty(item.Value) && !SessionHelper.UserPermissionList.Any(permission => permission.PermissionID == int.Parse(item.Value))).ToList().ForEach(this.Items.Remove); break;
            //    }
            //}
            base.OnPreRender(e);
        }
        protected override void OnPreRender(EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.LabelResourceKey) || !string.IsNullOrEmpty(this.LabelText))
            {
                this.lbl = Utilities.CreateLabel(this.LabelResourceKey, this.LabelText);
                this.Controls.Add(lbl);
            }

            if (this.IsRequired)
            {
                this.cstmValidator = Utilities.CreateCustomValidator(this.ID, this.ValidationGroup, "ValidateRadioButtonList", "RequiredErrorMessage");
                this.cstmValidator.Attributes.Add("data-list-id", this.ClientID);
                this.Controls.Add(cstmValidator);
            }

            if (!this.PropertiesLoaded)
            {
                this.CssClass         = "rdio-list";
                this.PropertiesLoaded = true;
            }

            base.OnPreRender(e);
        }
        protected override void OnLoad(EventArgs e)
        {
            lbl = Utilities.CreateLabel(this.LabelResourceKey);
            lbl.Style.Add("vertical-align", "top");

            fileUpld = new FileUpload
            {
                ID            = "fileUpld_" + this.ClientID,
                AllowMultiple = this.AllowMultiple
            };

            if (this.IsRequired)
            {
                cstmValidator = new CCustomValidator
                {
                    ID = "cstmValidator_" + this.ClientID,
                    ErrorMessageResourceKey  = this.RequiredValidatorErrorMessageResourceKey,
                    ValidationGroup          = this.ValidationGroup,
                    ClientValidationFunction = this.ClientValidationFunctionName
                };

                cstmValidator.Style.Add("position", "relative");
                cstmValidator.Style.Add("top", "-65%");
            }

            hfUpldFiles = new CHiddenField {
                ID = "hfUpldFiles_" + this.ClientID
            };
            hfClear = new CHiddenField {
                ID = "hfClear_" + this.ClientID
            };
            up = new UpdatePanel {
                ID = "up_" + this.ClientID
            };

            uploaderError = new HtmlGenericControl("p")
            {
                ID = "uploaderError_" + this.ClientID
            };
            uploaderError.Attributes.Add("class", "alert alert-error");
            uploaderError.Attributes.Add("style", "display:none;width:50%;");

            up.ContentTemplateContainer.Controls.Add(lbl);

            if (this.IsRequired)
            {
                up.ContentTemplateContainer.Controls.Add(new Label {
                    CssClass = "required", Text = "*"
                });
                up.ContentTemplateContainer.Controls.Add(cstmValidator);
            }

            up.ContentTemplateContainer.Controls.Add(fileUpld);


            up.ContentTemplateContainer.Controls.Add(hfUpldFiles);
            up.ContentTemplateContainer.Controls.Add(hfClear);
            up.ContentTemplateContainer.Controls.Add(uploaderError);
            Controls.Add(up);

            JIC.Crime.View.WebFormHelpers.Utilities.AddCssToPageHeader(this.Page.Header, "/Layouts/css/uploadify_{langType}.css");
            JIC.Crime.View.WebFormHelpers.Utilities.AddJsToPageHeader(this.Page.Header, "/Layouts/js/uploadify/{langCode}.js");
        }
Exemple #4
0
        protected override void OnLoad(EventArgs e)
        {
            lbl = Utilities.CreateLabel(this.LabelResourceKey);
            lbl.Style.Add("vertical-align", "top");
            fileUpld = new Table()
            {
                ID          = "fileUpld_" + this.ClientID,
                BorderWidth = 1,
                CssClass    = "table table-bordered"
            };
            fileUpld.Style.Add("display", "none");
            TableHeaderRow tr = new TableHeaderRow();

            tr.Cells.Add(new TableHeaderCell()
            {
                Text = "اسم الملف"
            });
            tr.Cells.Add(new TableHeaderCell()
            {
                Text = "نسبة الرفع"
            });
            tr.Cells.Add(new TableHeaderCell()
            {
                Text = "مسح"
            });
            fileUpld.Rows.Add(tr);
            container = new HtmlGenericControl("div")
            {
                ID = "container" + this.ClientID
            };


            container.Controls.Add(btnUploadFinished);

            pickFile = new Image
            {
                ID            = this.ClientID + "pickFile",
                ImageUrl      = "/Layouts/img/uploadify-upload.png",
                AlternateText = "[Select Files]"
            };
            container.Controls.Add(pickFile);


            if (this.IsRequired)
            {
                cstmValidator = new CCustomValidator
                {
                    ID = "cstmValidator_" + this.ClientID,
                    ErrorMessageResourceKey  = this.RequiredValidatorErrorMessageResourceKey,
                    ValidationGroup          = this.ValidationGroup,
                    ClientValidationFunction = this.ClientValidationFunctionName
                };

                cstmValidator.Style.Add("position", "relative");
                cstmValidator.Style.Add("top", "-65%");
            }

            hfUpldFiles = new CHiddenField {
                ID = "hfUpldFiles_" + this.ClientID
            };
            hfClear = new CHiddenField {
                ID = "hfClear_" + this.ClientID
            };
            up = new UpdatePanel {
                ID = "up_" + this.ClientID
            };

            uploaderError = new HtmlGenericControl("p")
            {
                ID = "uploaderError_" + this.ClientID
            };
            uploaderError.Attributes.Add("class", "alert alert-error");
            uploaderError.Attributes.Add("style", "display:none;width:50%;");

            up.ContentTemplateContainer.Controls.Add(lbl);

            if (this.IsRequired)
            {
                up.ContentTemplateContainer.Controls.Add(new Label {
                    CssClass = "required", Text = "*"
                });
                up.ContentTemplateContainer.Controls.Add(cstmValidator);
            }

            up.ContentTemplateContainer.Controls.Add(container);
            up.ContentTemplateContainer.Controls.Add(fileUpld);


            up.ContentTemplateContainer.Controls.Add(hfUpldFiles);
            up.ContentTemplateContainer.Controls.Add(hfClear);
            up.ContentTemplateContainer.Controls.Add(uploaderError);
            Controls.Add(up);

            JIC.Crime.View.WebFormHelpers.Utilities.AddCssToPageHeader(this.Page.Header, "/Layouts/css/jquery.plupload.queue.css");
            JIC.Crime.View.WebFormHelpers.Utilities.AddJsToPageHeader(this.Page.Header, "/Layouts/js/plupload/plupload.full.min.js");
            //JIC.View.Utilities.Utilities.AddJsToPageHeader(this.Page.Header, "/Layouts/js/plupload/i18n/{langCode}.js");
        }