//------------------------------------------------------ // 其它控件的值获取 //------------------------------------------------------ /// <summary>获取文本框整型数据(RealTextField 的子类有:TextBox, NumberBox, DatePicker)</summary> public static int?GetTextBoxIntValue(RealTextField tb, int?defaultValue = null) { if (tb.Text.IsNullOrEmpty()) { return(defaultValue); } else { return(int.Parse(tb.Text)); } }
/// <summary>获取文本框Double数据(RealTextField 的子类有:TextBox, NumberBox, DatePicker)</summary> public static double?GetTextBoxDoubleValue(RealTextField tb, double?defaultValue = null) { if (tb.Text.IsNullOrEmpty()) { return(defaultValue); } else { return(double.Parse(tb.Text)); } }
/// <summary> /// 文本框 /// </summary> /// <param name="field"></param> /// <param name="control"></param> /// <param name="canSave"></param> protected virtual void SetFormItemTextBox(FieldItem field, RealTextField control, Boolean canSave) { Type type = field.Type; Object value = Entity[field.Name]; if (type == typeof(DateTime)) { DateTime d = (DateTime)value; if (IsNullKey && d == DateTime.MinValue) { d = DateTime.Now; } (control as DatePicker).SelectedDate = d; } else { if (!SetControlValue(control, value)) { control.Text = value.ToString(); } } }