YKT_WebControls/DateEditBox.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.ComponentModel;

using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace YKT_WebControls
{
    [DefaultProperty("Value")]
    [ToolboxData("<{0}:DateEditBox runat=server></{0}:DateEditBox>")]
    public class DateEditBox : CompositeControl
    {
        private TextBox txtMonth = new TextBox();
        private TextBox txtDay = new TextBox();
        private TextBox txtYear = new TextBox();

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            txtMonth.ID = this.ID + "_month";
            txtMonth.MaxLength = 2;
            txtMonth.Width = this.Width;

            txtDay.ID = this.ID + "_day";
            txtDay.MaxLength = 2;
            txtDay.Width = this.Width;

            txtYear.ID = this.ID + "_year";
            txtYear.MaxLength = 4;
            txtYear.Width = this.Width;
        }

        [Bindable(true)]
        [Category("Appearance")]
        [DefaultValue("")]
        [Localizable(true)]
        public DateTime Value
        {
            get
            {
                EnsureChildControls();
                if (txtMonth.Text == "" || txtDay.Text == "" ||
                    txtYear.Text == "")
                    return DateTime.MinValue;
                else
                    return new DateTime(Convert.ToInt32(txtYear.Text),
                       Convert.ToInt32(txtMonth.Text),
                       Convert.ToInt32(txtDay.Text));
            }

            set
            {
                EnsureChildControls();
                txtMonth.Text = value.Month.ToString();
                txtDay.Text = value.Day.ToString();
                txtYear.Text = value.Year.ToString();
            }
后面还有 34 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。