コード例 #1
0
 protected override void CreateChildControls()
 {
     base.CreateChildControls();
     this.txtDate          = new StyledTextBox();
     this.txtDate.ID       = "txtDate";
     this.txtDate.CssClass = "masked_calendar_date";
     this.txtDate.ReadOnly = this._readOnly;
     if (this._readOnly)
     {
         this.txtDate.ApplyStyle(this._readOnlyStyle);
     }
     else
     {
         this.txtDate.ApplyStyle(this._normalStyle);
     }
     this.Controls.Add(this.txtDate);
     this.txtTime          = new StyledTextBox();
     this.txtTime.ID       = "txtTime";
     this.txtTime.CssClass = "masked_calendar_time";
     this.txtTime.Visible  = false;
     this.txtTime.ReadOnly = this._readOnly;
     if (this._readOnly)
     {
         this.txtTime.ApplyStyle(this._readOnlyStyle);
     }
     else
     {
         this.txtTime.ApplyStyle(this._normalStyle);
     }
     this.Controls.Add(this.txtTime);
     this.maskDate    = new MaskedEditExtender();
     this.maskDate.ID = "maskDate";
     this.maskDate.TargetControlID = "txtDate";
     this.maskDate.MaskType        = MaskedEditType.Date;
     this.maskDate.Mask            = "99/99/9999";
     this.Controls.Add(this.maskDate);
     this.maskTime    = new MaskedEditExtender();
     this.maskTime.ID = "maskTime";
     this.maskTime.TargetControlID = "txtTime";
     this.maskTime.MaskType        = MaskedEditType.Time;
     this.maskTime.Mask            = "99:99";
     this.maskTime.AcceptAMPM      = false;
     this.Controls.Add(this.maskTime);
     this.calDate    = new CalendarExtender();
     this.calDate.ID = "calDate";
     this.calDate.TargetControlID = "txtDate";
     this.Controls.Add(this.calDate);
     this.calDate.Enabled      = !this._readOnly;
     this.calDate.Format       = Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern;
     this.maskDate.CultureName = Thread.CurrentThread.CurrentCulture.Name;
 }
コード例 #2
0
ファイル: FormViewBuilder.cs プロジェクト: t1b1c/lwas
 private Control CreateEditableControl(string type)
 {
     Control control;
     switch (type)
     {
         case "Text":
         {
             control = new StyledTextBox();
             break;
         }
         case "Date":
         {
             control = new MaskedCalendar();
             break;
         }
         case "Number":
         {
             control = new NumberTextBox();
             break;
         }
         case "DropDownList":
         {
             control = new StatelessDropDownList();
             break;
         }
         case "Link":
         {
             control = new HyperLink();
             break;
         }
         case "CheckBox":
         {
             control = new CheckBox();
             break;
         }
         case "Label":
         {
             control = new Label();
             ((Label)control).Text = "[label]";
             break;
         }
         case "Hidden":
         {
             control = new HiddenField();
             break;
         }
         default:
         {
             throw new ArgumentException("Unknown form view field type " + type);
         }
     }
     return control;
 }
コード例 #3
0
ファイル: MaskedCalendar.cs プロジェクト: t1b1c/lwas
 protected override void CreateChildControls()
 {
     base.CreateChildControls();
     this.txtDate = new StyledTextBox();
     this.txtDate.ID = "txtDate";
     this.txtDate.CssClass = "masked_calendar_date";
     this.txtDate.ReadOnly = this._readOnly;
     if (this._readOnly)
     {
         this.txtDate.ApplyStyle(this._readOnlyStyle);
     }
     else
     {
         this.txtDate.ApplyStyle(this._normalStyle);
     }
     this.Controls.Add(this.txtDate);
     this.txtTime = new StyledTextBox();
     this.txtTime.ID = "txtTime";
     this.txtTime.CssClass = "masked_calendar_time";
     this.txtTime.Visible = false;
     this.txtTime.ReadOnly = this._readOnly;
     if (this._readOnly)
     {
         this.txtTime.ApplyStyle(this._readOnlyStyle);
     }
     else
     {
         this.txtTime.ApplyStyle(this._normalStyle);
     }
     this.Controls.Add(this.txtTime);
     this.maskDate = new MaskedEditExtender();
     this.maskDate.ID = "maskDate";
     this.maskDate.TargetControlID = "txtDate";
     this.maskDate.MaskType = MaskedEditType.Date;
     this.maskDate.Mask = "99/99/9999";
     this.Controls.Add(this.maskDate);
     this.maskTime = new MaskedEditExtender();
     this.maskTime.ID = "maskTime";
     this.maskTime.TargetControlID = "txtTime";
     this.maskTime.MaskType = MaskedEditType.Time;
     this.maskTime.Mask = "99:99";
     this.maskTime.AcceptAMPM = false;
     this.Controls.Add(this.maskTime);
     this.calDate = new CalendarExtender();
     this.calDate.ID = "calDate";
     this.calDate.TargetControlID = "txtDate";
     this.Controls.Add(this.calDate);
     this.calDate.Enabled = !this._readOnly;
     this.calDate.Format = Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern;
     this.maskDate.CultureName = Thread.CurrentThread.CurrentCulture.Name;
 }