/// <summary> /// 设置属性 /// </summary> protected override void SetAttributes() { DatePicker control = this.ControlHost.Content as DatePicker; this.HtmlWriter.AddAttribute("dojoType", "Controls/DateTextBox"); if (!IsPreview && !string.IsNullOrEmpty(this.ControlHost.Name)) { this.HtmlWriter.AddAttribute("id", this.ControlHost.Name); this.HtmlWriter.AddAttribute("name", this.ControlHost.Name); } if (!string.IsNullOrEmpty(control.ToolTip) && this.ProjectDocument != null) { this.HtmlWriter.AddAttribute("tooltip-name", this.ProjectDocument.Name + "_" + control.ToolTip); } StringBuilder sbProps = new StringBuilder(); StringBuilder sbConstraints = new StringBuilder(); StringBuilder returnContent = new StringBuilder(); string props = control.BuildControlProps(this.ScreenDefinition, this.IsPreview, this.PermissionData, returnContent, sbConstraints); if (!string.IsNullOrEmpty(props)) { sbProps.AppendFormat("{0},", props); } string datePatternStr = "yyyy-MM-dd"; if (!string.IsNullOrEmpty(control.DatePattern)) { datePatternStr = control.DatePattern; } sbConstraints.AppendFormat("{0},", "datePattern:'" + datePatternStr + "'"); if (sbConstraints.ToString().Length > 0) { string constrains = sbConstraints.ToString().Substring(0, sbConstraints.ToString().Length - 1); sbProps.Append("constraints:{" + constrains + "},"); } if (sbProps.ToString().Length > 0) { this.HtmlWriter.AddAttribute("data-dojo-props", sbProps.ToString().Substring(0, sbProps.ToString().Length - 1), false); } base.SetAttributes(); }