示例#1
0
        protected override void OnPreRender(EventArgs e)
        {
            if (!IsPostBack)
            {
                if (((DateTime?)FieldValue).HasValue)
                {
                    Calendar1.SelectedDate      = ((DateTime?)FieldValue).Value;
                    DateTimePicker.SelectedDate = ((DateTime?)FieldValue).Value;
                }

                if (!_useTimePicker)
                {
                    Calendar1.DataBind();
                }
                else
                {
                    DateTimePicker.DataBind();
                }
            }
            FieldLabel.Text           = GetMetaDataValue("Name", Attribute.StaticName);
            FieldLabel.HelpText       = GetMetaDataValue <string>("Notes");
            valCalendar1.Enabled      = GetMetaDataValue <bool>("Required");
            valDateTimePicker.Enabled = GetMetaDataValue <bool>("Required");

            base.OnPreRender(e);
        }