Exemplo n.º 1
0
        /// <summary>
        /// 设置子元素
        /// </summary>
        protected override void SetChildElements()
        {
            FileUploader control = this.ControlHost.Content as FileUploader;

            this.HtmlWriter.AddAttribute("dojoType", "Controls/Uploader");
            if (!IsPreview && !string.IsNullOrEmpty(this.ControlHost.Name))
            {
                this.HtmlWriter.AddAttribute("id", this.ControlHost.Name);
                this.HtmlWriter.AddAttribute("name", this.ControlHost.Name);
            }

            StringBuilder sbProps       = new StringBuilder();
            StringBuilder returnContent = new StringBuilder();
            string        props         = control.BuildControlProps(this.ScreenDefinition, this.IsPreview, this.PermissionData, returnContent);

            if (!string.IsNullOrEmpty(props))
            {
                sbProps.AppendFormat("{0},", props);
            }
            sbProps.AppendFormat("multiple:{0},", control.Multiple.ToString().ToLower());
            if (!string.IsNullOrEmpty(control.ProgressWidgetId))
            {
                sbProps.AppendFormat("progressWidgetId:'{0}',", this.ProjectDocument.Name + "_" + control.ProgressWidgetId);
            }
            sbProps.AppendFormat("uploadUrl:'{0}',", control.UploadUrl);
            sbProps.AppendFormat("showInput:'before',");

            if (sbProps.ToString().Length > 0)
            {
                this.HtmlWriter.AddAttribute("data-dojo-props", sbProps.ToString().Substring(0, sbProps.ToString().Length - 1), false);
            }

            this.HtmlWriter.RenderBeginTag("div");
            this.HtmlWriter.WriteEncodedText("选择...");

            this.HtmlWriter.RenderEndTag();
        }